Артем Тритяк
Unittesting frontend
applications at
Backbone.js example
Why?
❖ Regressions testing is too long!
❖ Short sprints issues!
❖ Dangerous refactoring!
❖ Test API usability!
❖ Отличная ...
What test?
Business logic Public API
What test?
Business logic Public API
Model!
(Service)
Collection Controller
What test?
Shared functionality
Mixins
Base!
views, controllers, models
Helpers
Clean your karma
Karma Test Runner
Karma Test Runner
Karma Test Runner
Karma Test Runner
Runners: Grunt
Runners: Gulp
Istanbul: Code Coverage
Istanbul Karma Gulp
Istanbul: Code Coverage
Karma + Require.js
Karma + Require.js
Jasmine 2.0 / Mocha+Chai
beforeEach / afterEach
Async tests
Sinon.js: Mock XHR
Sinon.js: Stub methods
Sinon.js: Fake and Test
❖ Fake timers: sinon.useFakeTimers();!
❖ Check calls: spy, .calledWith(…), .callCount() etc;!
❖ Ha...
Backbone.Model
Backbone.Collection
Backbone.Collection
Backbone.Controller
Backbone.Controller? WTF?
❖ https://github.com/artyomtrityak/backbone.controller!
❖ Backbone.Marionette controller!
❖ Back...
Backbone.View
No tests
Front-End UnitTesting
Front-End UnitTesting
Upcoming SlideShare
Loading in …5
×

Front-End UnitTesting

953 views

Published on

How to write unittests, launch multiple browsers and mock data

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
953
On SlideShare
0
From Embeds
0
Number of Embeds
23
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Front-End UnitTesting

  1. 1. Артем Тритяк Unittesting frontend applications at Backbone.js example
  2. 2. Why? ❖ Regressions testing is too long! ❖ Short sprints issues! ❖ Dangerous refactoring! ❖ Test API usability! ❖ Отличная отмаза: «Что делаете? Пишем тесты!»
  3. 3. What test? Business logic Public API
  4. 4. What test? Business logic Public API Model! (Service) Collection Controller
  5. 5. What test? Shared functionality Mixins Base! views, controllers, models Helpers
  6. 6. Clean your karma
  7. 7. Karma Test Runner
  8. 8. Karma Test Runner
  9. 9. Karma Test Runner
  10. 10. Karma Test Runner
  11. 11. Runners: Grunt
  12. 12. Runners: Gulp
  13. 13. Istanbul: Code Coverage
  14. 14. Istanbul Karma Gulp
  15. 15. Istanbul: Code Coverage
  16. 16. Karma + Require.js
  17. 17. Karma + Require.js
  18. 18. Jasmine 2.0 / Mocha+Chai
  19. 19. beforeEach / afterEach
  20. 20. Async tests
  21. 21. Sinon.js: Mock XHR
  22. 22. Sinon.js: Stub methods
  23. 23. Sinon.js: Fake and Test ❖ Fake timers: sinon.useFakeTimers();! ❖ Check calls: spy, .calledWith(…), .callCount() etc;! ❖ Have fun
  24. 24. Backbone.Model
  25. 25. Backbone.Collection
  26. 26. Backbone.Collection
  27. 27. Backbone.Controller
  28. 28. Backbone.Controller? WTF? ❖ https://github.com/artyomtrityak/backbone.controller! ❖ Backbone.Marionette controller! ❖ Backbone.Chaplin controller
  29. 29. Backbone.View No tests

×