FrontendLab: Воркшоп "Just Test It". Артем Тритяк, Electric Cloud

629 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
629
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

FrontendLab: Воркшоп "Just Test It". Артем Тритяк, Electric Cloud

  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

×