0
Just Test It
Karma, Mocha, Sinon.js

Artyom Trityak
Why test?
It’s impossible to do regression testing for big projects
Want to do refactoring - test it!
Want to deploy each ...
What test?
Business logic
What test?
Business logic where?

Models
Controllers
Views
What test?
Business logic
Models
Controllers
What test?
Business logic
Models
Controllers
Shared functionality (base classes, utils etc)
How test: Karma
Runs your unittests in different browsers automatically:
Chrome, Phantomjs, Firefox, Safari, IE
Run-on-cha...
How test: Karma
How test: Sinon.js
Mock modules dependencies
Mock backend requests and responses
Mock / stub methods and objects
Check met...
How test: Sinon.js
How test: Mocha+Chai
or Jasmine

Test async behaviors
Different reports
Both fine: Mocha+Chai or Jasmine (2.0 is out)
Jasm...
How test: Mocha+Chai
or Jasmine
How test: Mocha+Chai
or Jasmine
How test: Require.js
Test modular code
Clean state for each test
How test: Require.js
Just Test It
Upcoming SlideShare
Loading in...5
×

Just Test It

776

Published on

My talk about frontend unittesting.
Karma, Mocha, Chai, Sinonjs, Require.js.

Why test? What test? How test?

Published in: Technology, Business
1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total Views
776
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
10
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide

Transcript of "Just Test It"

  1. 1. Just Test It Karma, Mocha, Sinon.js Artyom Trityak
  2. 2. Why test? It’s impossible to do regression testing for big projects Want to do refactoring - test it! Want to deploy each sprint - test it! Want to show how to use your module - test it!
  3. 3. What test? Business logic
  4. 4. What test? Business logic where? Models Controllers Views
  5. 5. What test? Business logic Models Controllers
  6. 6. What test? Business logic Models Controllers Shared functionality (base classes, utils etc)
  7. 7. How test: Karma Runs your unittests in different browsers automatically: Chrome, Phantomjs, Firefox, Safari, IE Run-on-change Test in real devices: phones, tablets etc
  8. 8. How test: Karma
  9. 9. How test: Sinon.js Mock modules dependencies Mock backend requests and responses Mock / stub methods and objects Check methods calledWith and callCount
  10. 10. How test: Sinon.js
  11. 11. How test: Mocha+Chai or Jasmine Test async behaviors Different reports Both fine: Mocha+Chai or Jasmine (2.0 is out) Jasmine 2.0 supports Mocha-style «done» callback for async tests
  12. 12. How test: Mocha+Chai or Jasmine
  13. 13. How test: Mocha+Chai or Jasmine
  14. 14. How test: Require.js Test modular code Clean state for each test
  15. 15. How test: Require.js
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×