Upgrade to Pro — share decks privately, control downloads, hide ads and more …

UJUG - Javascript Unit Testing

UJUG - Javascript Unit Testing

Three ingredients that go well together: JavaScript Unit Tests + Karma + Sauce Labs

Code Repo: https://github.com/saucelabs/karma-sauce-example

Sebastian Tiedtke

March 20, 2014
Tweet

More Decks by Sebastian Tiedtke

Other Decks in Programming

Transcript

  1. Javascript Unit Testing ! Three ingredients that go well together:

    JavaScript Unit Tests + Karma + Sauce Labs Sebastian Tiedtke, @sourishkrout
  2. What’s a Javascript Unit Test? ! ! Let’s look at

    an example: ! h>ps://saucelabs.com/test_helpers/front_tests/index.html !
  3. Why? ! ! ! Rich interactive client side apps HTML5

    enabled (new APIs) Test units of Javascript code Run in native environment Variety of JS engines
  4. Sauce Labs! ! ! ! ! ! ! ! Rich

    Test Dashboard + REST API access Fast Diagnosis Screenshots & Screencasts Various Logs to Aid Debugging Pristine VMs (Security) + Encrypted Tunnel Secure Temporary Storage for Apps
  5. Javascript Unit Testing API ! ! ! ! ! !

    ! ! ! ! ! ! curl  -­‐X  POST  h>ps://saucelabs.com/rest/v1/$SAUCE_USERNAME/js-­‐tests  \          -­‐u  $SAUCE_USERNAME:$SAUCE_ACCESS_KEY  \          -­‐d  plaSorms='[["Windows  8",  "internet  explorer",  "10"],                                        ["OS  X  10.8",  "safari",  "6"]]'  \          -­‐d  url="h>ps://saucelabs.com/test_helpers/front_tests/index.html"  \          -­‐d  framework=jasmine
  6. Test Runner + CI ! ! ! ! Fast feedback

    loop Test execution based on file events Let Sauce Labs provide the browsers ! ! ! ! !
  7. Demo + Live Coding ! ! ! ! ! Step

    by step: h>ps://github.com/saucelabs/karma-­‐sauce-­‐example ! ! At scale: h>ps://github.com/angular/angular.js ! !