Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.
1
CONFIDENTIAL
Andrew Winder
Senior Software Engineer, Message Systems
Testing Javascript with Mocha and
Friends
July 31, ...
2
Why Testing?
3
What is a test?
expect(something).to.equal(something)
4
What is a test?
expect(something).to.equal(something)
The Subject
5
What is a test?
expect(something).to.equal(something)
The Assertion
6
What Kind of Testing?
7
How to test Javascript?
8
Simple Unit Testing
9
What about Async?
10
What about Async?
11
Mocking with Sinon & Proxyquire
• Use Mocks in unit testing for:
• Stability
• Speed
• Accuracy
• Proxyquire for Mock I...
12
Example of ProxyQuire & Sinon.JS
13
Demo & Questions
Twitter: @awinder
andrew.winder@messagesystems.com
Próxima SlideShare
Cargando en…5
×

Testing Javascript Apps with Mocha and Chai

Testing code is very important and leads to more well-thought-out designs and more stable codebases. But how do we test javascript applications? Tools like Sinon.js, Mocha, and Chai can alleviate some of the pain as we try to bring testing benefits into our applications

  • Sé el primero en comentar

Testing Javascript Apps with Mocha and Chai

  1. 1. 1 CONFIDENTIAL Andrew Winder Senior Software Engineer, Message Systems Testing Javascript with Mocha and Friends July 31, 2014
  2. 2. 2 Why Testing?
  3. 3. 3 What is a test? expect(something).to.equal(something)
  4. 4. 4 What is a test? expect(something).to.equal(something) The Subject
  5. 5. 5 What is a test? expect(something).to.equal(something) The Assertion
  6. 6. 6 What Kind of Testing?
  7. 7. 7 How to test Javascript?
  8. 8. 8 Simple Unit Testing
  9. 9. 9 What about Async?
  10. 10. 10 What about Async?
  11. 11. 11 Mocking with Sinon & Proxyquire • Use Mocks in unit testing for: • Stability • Speed • Accuracy • Proxyquire for Mock Injection • Sinon for creating Mocks
  12. 12. 12 Example of ProxyQuire & Sinon.JS
  13. 13. 13 Demo & Questions Twitter: @awinder andrew.winder@messagesystems.com

×