Slide 1

Slide 1 text

Promo  code:  UJUG_2014   saucelabs.com/signup

Slide 2

Slide 2 text

Javascript Unit Testing ! Three ingredients that go well together: JavaScript Unit Tests + Karma + Sauce Labs Sebastian Tiedtke, @sourishkrout

Slide 3

Slide 3 text

What’s a Javascript Unit Test? ! ! !

Slide 4

Slide 4 text

What’s a Javascript Unit Test? ! ! Let’s look at an example: ! h>ps://saucelabs.com/test_helpers/front_tests/index.html !

Slide 5

Slide 5 text

Why? ! ! ! Rich interactive client side apps HTML5 enabled (new APIs) Test units of Javascript code Run in native environment Variety of JS engines

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

Test Runner + CI ! ! ! ! Fast feedback loop Test execution based on file events Let Sauce Labs provide the browsers ! ! ! ! !

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

Thank you! ! ! http://saucelabs.com/javascript ! @sourishkrout ! Promo code: UJUG_2014