Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to Jasmine/Karma

8 views

Published on

Accompanying notes to a Youtube tutorial on Jasmine and Karma.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Introduction to Jasmine/Karma

  1. 1. Introduction to Jasmine and Karma
  2. 2. I am Brendon Body I am here because I am passionate about programming. You can find me at www.brendonbody.com or @DormeoES Hello! 2
  3. 3. “ Quality is never an accident; it is always the result of intelligent effort - John Ruskin 3
  4. 4. This talk TOPICS 1. Setup: Jasmine/Karma 2. Simple tests 3. Environmental tests 4. AJAX tests 5. CI Server 6. Conclusion 4
  5. 5. Setup Getting setup with Karma and Jasmine 1 5
  6. 6. Tools/Frameworks ◉ Karma: test runner which handles the test framework and browser setups ◉ Jasmine: JavaScript unit testing library ◉ Jasmine AJAX: helper for Jasmine to intercept AJAX calls ◉ Headless Chrome: Chrome run without a UI 6
  7. 7. Process Map 7
  8. 8. ◉ Initialize NPM ◉ Initialize Karma ◉ Setup Folders Setup Jasmine/Karma 8
  9. 9. Simple Tests Simple input and output code tests 2 9
  10. 10. Environment Tests Environmental altering code tests 3 10
  11. 11. ◉ Fast: tests must be run fast, reducing feedback loop and can be run a lot ◉ Independent: tests aren’t reliant on each other ◉ Repeatable: can be run many times, different times, different systems and yield same result ◉ Self-validating: doesn’t need a human to validate ◉ Thorough: should cover a representative set of use cases (not just code coverage) FIRST Principle 11
  12. 12. AJAX Tests Stubbing remote call tests 4 12
  13. 13. CI Server Automate the repetitive 5 13
  14. 14. Conclusion Ending this fun 6 14
  15. 15. Any questions? Leave questions below in the comments and I will try to answer them! Thanks! 15

×