Your SlideShare is downloading. ×
Just Test It
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Just Test It

658
views

Published on

My talk about frontend unittesting. …

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
658
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
8
Comments
1
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Just Test It Karma, Mocha, Sinon.js Artyom Trityak
  • 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. What test? Business logic
  • 4. What test? Business logic where? Models Controllers Views
  • 5. What test? Business logic Models Controllers
  • 6. What test? Business logic Models Controllers Shared functionality (base classes, utils etc)
  • 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. How test: Karma
  • 9. How test: Sinon.js Mock modules dependencies Mock backend requests and responses Mock / stub methods and objects Check methods calledWith and callCount
  • 10. How test: Sinon.js
  • 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. How test: Mocha+Chai or Jasmine
  • 13. How test: Mocha+Chai or Jasmine
  • 14. How test: Require.js Test modular code Clean state for each test
  • 15. How test: Require.js

×