test and behavior driven development in javascriptassets.en.oreilly.com/1/event/45/test and behavior...
TRANSCRIPT
![Page 2: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/2.jpg)
“JavaScript” means Different things to Different People
![Page 3: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/3.jpg)
<FORM NAME=‘FORM’><TABLE BORDER CELLPADDING=3><TR><TD><NOBR>radius: <INPUT NAME="Circle_radius" SIZE=4></NOBR></TD><TD><INPUT TYPE=BUTTON onclick="document.FORM.submit();" VALUE="calculate"></TD><TD ALIGN=RIGHT BGCOLOR="#AACCFF"><NOBR>circumference: <INPUT NAME="Circle_circumference" SIZE=9></NOBR><BR><NOBR>area: <INPUT NAME="Circle_area" SIZE=9></NOBR></TD></TR></TABLE></FORM>
![Page 4: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/4.jpg)
var http = require('http');http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('Hello World\n');}).listen(8124, "127.0.0.1");console.log('Server running at http://127.0.0.1:8124/');
![Page 5: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/5.jpg)
![Page 6: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/6.jpg)
Canvas
Offline Applications
Local Storage
Video
XMLHttpRequest
SVG
“HTML5”
![Page 7: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/7.jpg)
ChessFlock
![Page 8: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/8.jpg)
XMPP
![Page 9: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/9.jpg)
ejabberd
xmppxmpp
xmpp
![Page 10: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/10.jpg)
ejabberd
http
kibosh
http
httpkibosh kibosh
![Page 11: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/11.jpg)
ejabberd: XMPP server written in Erlang
kibosh: XMPP BOSH connection manager written in Ruby
strophejs: XMPP BOSH clientwritten in JavaScript
dramatis: actor librarywritten in JavaScript/Ruby/Python
chessflock: chess client/serverwritten in JavaScript/HTML/SVG
Server
Client
![Page 12: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/12.jpg)
Caveats
![Page 13: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/13.jpg)
Incomplete
![Page 14: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/14.jpg)
Low test coverage
![Page 15: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/15.jpg)
Egregiousstupidity
![Page 16: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/16.jpg)
Dramatistestbed
![Page 17: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/17.jpg)
“throw one away”
![Page 18: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/18.jpg)
Test Driven Development
![Page 19: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/19.jpg)
s/Test/Behavior/
![Page 20: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/20.jpg)
Test Driven Development
![Page 21: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/21.jpg)
Test Driven Development
![Page 22: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/22.jpg)
Test Driven Development
![Page 23: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/23.jpg)
Test Driven Development
![Page 24: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/24.jpg)
Write the tests first
![Page 25: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/25.jpg)
Red Green Refactor
![Page 26: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/26.jpg)
Flavors of tests
![Page 27: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/27.jpg)
Unit
![Page 28: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/28.jpg)
Irreducible
![Page 29: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/29.jpg)
Monolingual
![Page 30: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/30.jpg)
Integration
Multiple units
Maybe multiple languages
![Page 31: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/31.jpg)
System
![Page 32: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/32.jpg)
UnitMonolingual (JavaScript) Integration
Developer focused
![Page 33: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/33.jpg)
What makes JavaScript so special?
![Page 34: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/34.jpg)
Standard Library
or lack thereof
![Page 35: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/35.jpg)
ObjectArray
FunctionDateStringRegex
![Page 36: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/36.jpg)
Asynchronousno waitno sleep
not threads
![Page 37: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/37.jpg)
Asynchronousno waitno sleep
no threads
setTimeout
![Page 38: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/38.jpg)
Asynchronousno waitno sleep
no threads
window.setTimeout
![Page 39: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/39.jpg)
Asynchronousno waitno sleep
no threads
window.setTimeout
![Page 40: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/40.jpg)
Asynchronousno waitno sleep
no Threads
window.setTimeout
I/O
![Page 41: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/41.jpg)
Asynchronousno waitno sleep
no threads
window.setTimeout
I/O
Packaging
![Page 42: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/42.jpg)
Asynchronousno waitno sleep
no threads
window.setTimeout
I/O
Packaging
SpiderMonkey v8 SquirrelFish Rhino
![Page 43: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/43.jpg)
ObjectArray
FunctionDateStringRegex
Need more than this to run tests
![Page 44: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/44.jpg)
Beyond ES5
![Page 45: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/45.jpg)
CommonJS
![Page 46: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/46.jpg)
“HTML5”
![Page 47: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/47.jpg)
<HTML> <HEAD> <TITLE></TITLE> </HEAD> <BODY> </BODY></HTML>
![Page 48: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/48.jpg)
window
![Page 49: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/49.jpg)
window.setTimeout
![Page 50: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/50.jpg)
window.setTimeout
Timers / events / event loops
![Page 51: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/51.jpg)
window.XMLHttpRequest
![Page 52: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/52.jpg)
HTML5 implementations
![Page 53: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/53.jpg)
Browsers, of coursebut also ...
![Page 54: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/54.jpg)
HTMLUnit
Java
Rhino
![Page 55: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/55.jpg)
Env.js
“mostly” JavaScript
Rhino/SpiderMonkey
![Page 56: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/56.jpg)
JavaScript TDD/BDD vs ...
![Page 57: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/57.jpg)
Dynamically typed
Loose scoping
No protection levels
![Page 58: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/58.jpg)
Highly asynchronousLots of callbacks
Lots of async callbacks
![Page 59: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/59.jpg)
JavaScript TDD and BDD Frameworks
![Page 60: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/60.jpg)
But first ...
![Page 61: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/61.jpg)
JSLint
![Page 62: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/62.jpg)
JavaScript TDD: qunit
![Page 63: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/63.jpg)
test("module without setup/teardown (default)", function() { expect(1); ok(true);});
![Page 64: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/64.jpg)
test("module without setup/teardown (default)", function() { expect(1); ok(true);});
ok()equals()same()
![Page 65: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/65.jpg)
test("module without setup/teardown (default)", function() { expect(1); ok(true);});
ok()equals()same()
module()setup()teardown()
![Page 66: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/66.jpg)
test("runnable callbacks are run later with timeout of 0", function() { expect(2); var occurred = 0; setTimeout(function(){ occurred = Date.now(); }, 0); ok( occurred === 0, "Timeout callback was not executed immediately" ); setTimeout(function(){ ok( occurred !== 0, "Timeout callback executed" ); start(); },100); stop();});
Asynch test:test is not complete at the end of the function body
![Page 67: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/67.jpg)
test("runnable callbacks are run later with timeout of 0", function() { expect(2); var occurred = 0; setTimeout(function(){ occurred = Date.now(); }, 0); ok( occurred === 0, "Timeout callback was not executed immediately" ); setTimeout(function(){ ok( occurred !== 0, "Timeout callback executed" ); start(); },100); stop();});
stop()
![Page 68: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/68.jpg)
test("runnable callbacks are run later with timeout of 0", function() { expect(2); var occurred = 0; setTimeout(function(){ occurred = Date.now(); }, 0); ok( occurred === 0, "Timeout callback was not executed immediately" ); setTimeout(function(){ ok( occurred !== 0, "Timeout callback executed" ); start(); },100); stop();});
incomplete()
![Page 69: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/69.jpg)
test("runnable callbacks are run later with timeout of 0", function() { expect(2); var occurred = 0; setTimeout(function(){ occurred = Date.now(); }, 0); ok( occurred === 0, "Timeout callback was not executed immediately" ); setTimeout(function(){ ok( occurred !== 0, "Timeout callback executed" ); start(); },100); stop();});
start()
![Page 70: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/70.jpg)
test("runnable callbacks are run later with timeout of 0", function() { expect(2); var occurred = 0; setTimeout(function(){ occurred = Date.now(); }, 0); ok( occurred === 0, "Timeout callback was not executed immediately" ); setTimeout(function(){ ok( occurred !== 0, "Timeout callback executed" ); start(); },100); stop();});
complete()
![Page 71: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/71.jpg)
test("runnable callbacks are run later with timeout of 0", function() { expect(2); var occurred = 0; setTimeout(function(){ occurred = Date.now(); }, 0); ok( occurred === 0, "Timeout callback was not executed immediately" ); setTimeout(function(){ ok( occurred !== 0, "Timeout callback executed" ); start(); },100); stop();});
expect(n)
![Page 72: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/72.jpg)
What if start() is never called?
![Page 73: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/73.jpg)
JavaScript BDD: Jasmine
![Page 74: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/74.jpg)
it("should return the game to the players",function(){ var tom = { player_name: function(){ return "tom"; }}; var jerry = { player_name: function(){ return "tom"; }}; var toms_game; var jerrys_game; this.server.join(tom, function(game) { toms_game = game; if (jerrys_game) { expect(toms_game).toBe(jerrys_game); complete(); } }); this.server.join(jerry, function(game) { jerrys_game = game; if (toms_game) { expect(toms_game).toBe(jerrys_game); complete(); } }); incomplete(); });
it(...)expect(...).toSomething()
complete/incomplete(...)
![Page 75: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/75.jpg)
Ready, Set, Go ...
![Page 76: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/76.jpg)
Uh ...
![Page 77: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/77.jpg)
Fixtures
![Page 78: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/78.jpg)
<!DOCTYPE html><html><head> <title>QUnit Test Suite</title> <link rel="stylesheet" href="../qunit/qunit.css" type="text/css" media="screen"> <script type="text/javascript" src="../qunit/qunit.js"></script> <script type="text/javascript" src="test.js"></script> <script type="text/javascript" src="same.js"></script></head><body> <h1 id="qunit-header">QUnit Test Suite</h1> <h2 id="qunit-banner"></h2> <div id="qunit-testrunner-toolbar"></div> <h2 id="qunit-userAgent"></h2> <ol id="qunit-tests"></ol></body></html>
![Page 79: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/79.jpg)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <title>Jasmine Test Runner</title>
<script type="text/javascript"> // yes, really keep this here to keep us honest, but only for jasmine's own runner! [xw] undefined = "diz be undefined yo"; </script>
<script type="text/javascript" src="../src/base.js"></script> <script type="text/javascript" src="../src/util.js"></script> <script type="text/javascript" src="../src/Env.js"></script> <script type="text/javascript" src="../src/Reporter.js"></script> <script type="text/javascript" src="../src/Block.js"></script>
<script type="text/javascript" src="../src/JsApiReporter.js"></script> <script type="text/javascript" src="../src/Matchers.js"></script> <script type="text/javascript" src="../src/mock-timeout.js"></script> <script type="text/javascript" src="../src/MultiReporter.js"></script> <script type="text/javascript" src="../src/NestedResults.js"></script> <script type="text/javascript" src="../src/PrettyPrinter.js"></script> <script type="text/javascript" src="../src/Queue.js"></script> <script type="text/javascript" src="../src/Runner.js"></script> <script type="text/javascript" src="../src/Spec.js"></script> <script type="text/javascript" src="../src/Suite.js"></script> <script type="text/javascript" src="../src/WaitsBlock.js"></script> <script type="text/javascript" src="../src/WaitsForBlock.js"></script>
<script type="text/javascript" src="../src/html/TrivialReporter.js"></script>
<script type="text/javascript" src="suites/BaseSpec.js"></script> <script type="text/javascript" src="suites/CustomMatchersSpec.js"></script> <script type="text/javascript" src="suites/EnvSpec.js"></script> <script type="text/javascript" src="suites/ExceptionsSpec.js"></script> <script type="text/javascript" src="suites/JsApiReporterSpec.js"></script> <script type="text/javascript" src="suites/MatchersSpec.js"></script> <script type="text/javascript" src="suites/MockClockSpec.js"></script> <script type="text/javascript" src="suites/MultiReporterSpec.js"></script> <script type="text/javascript" src="suites/NestedResultsSpec.js"></script> <script type="text/javascript" src="suites/PrettyPrintSpec.js"></script> <script type="text/javascript" src="suites/ReporterSpec.js"></script> <script type="text/javascript" src="suites/RunnerSpec.js"></script> <script type="text/javascript" src="suites/QueueSpec.js"></script> <script type="text/javascript" src="suites/SpecSpec.js"></script> <script type="text/javascript" src="suites/SpecRunningSpec.js"></script> <script type="text/javascript" src="suites/SpySpec.js"></script> <script type="text/javascript" src="suites/SuiteSpec.js"></script> <script type="text/javascript" src="suites/TrivialReporterSpec.js"></script> <script type="text/javascript" src="suites/WaitsForBlockSpec.js"></script>
<script type="text/javascript"> (function() { var jasmineEnv = jasmine.getEnv(); jasmineEnv.updateInterval = 1000;
var trivialReporter = new jasmine.TrivialReporter();
jasmineEnv.addReporter(trivialReporter);
jasmineEnv.specFilter = function(spec) { return trivialReporter.specFilter(spec); };
window.onload = function() { jasmineEnv.execute(); }; })(); </script>
<link href="../src/html/jasmine.css" rel="stylesheet"/></head>
<body></body></html>
![Page 80: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/80.jpg)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head> <title>Jasmine Test Runner</title>
<script type="text/javascript"> // yes, really keep this here to keep us honest, but only for jasmine's own runner! [xw] undefined = "diz be undefined yo"; </script>
<script type="text/javascript" src="../src/base.js"></script> <script type="text/javascript" src="../src/util.js"></script> <script type="text/javascript" src="../src/Env.js"></script> <script type="text/javascript" src="../src/Reporter.js"></script> <script type="text/javascript" src="../src/Block.js"></script>
<script type="text/javascript" src="../src/JsApiReporter.js"></script> <script type="text/javascript" src="../src/Matchers.js"></script> <script type="text/javascript" src="../src/mock-timeout.js"></script> <script type="text/javascript" src="../src/MultiReporter.js"></script> <script type="text/javascript" src="../src/NestedResults.js"></script> <script type="text/javascript" src="../src/PrettyPrinter.js"></script> <script type="text/javascript" src="../src/Queue.js"></script> <script type="text/javascript" src="../src/Runner.js"></script> <script type="text/javascript" src="../src/Spec.js"></script> <script type="text/javascript" src="../src/Suite.js"></script> <script type="text/javascript" src="../src/WaitsBlock.js"></script> <script type="text/javascript" src="../src/WaitsForBlock.js"></script>
<script type="text/javascript" src="../src/html/TrivialReporter.js"></script>
<script type="text/javascript" src="suites/BaseSpec.js"></script> <script type="text/javascript" src="suites/CustomMatchersSpec.js"></script> <script type="text/javascript" src="suites/EnvSpec.js"></script> <script type="text/javascript" src="suites/ExceptionsSpec.js"></script> <script type="text/javascript" src="suites/JsApiReporterSpec.js"></script> <script type="text/javascript" src="suites/MatchersSpec.js"></script> <script type="text/javascript" src="suites/MockClockSpec.js"></script> <script type="text/javascript" src="suites/MultiReporterSpec.js"></script> <script type="text/javascript" src="suites/NestedResultsSpec.js"></script> <script type="text/javascript" src="suites/PrettyPrintSpec.js"></script> <script type="text/javascript" src="suites/ReporterSpec.js"></script> <script type="text/javascript" src="suites/RunnerSpec.js"></script> <script type="text/javascript" src="suites/QueueSpec.js"></script> <script type="text/javascript" src="suites/SpecSpec.js"></script> <script type="text/javascript" src="suites/SpecRunningSpec.js"></script> <script type="text/javascript" src="suites/SpySpec.js"></script> <script type="text/javascript" src="suites/SuiteSpec.js"></script> <script type="text/javascript" src="suites/TrivialReporterSpec.js"></script> <script type="text/javascript" src="suites/WaitsForBlockSpec.js"></script>
<script type="text/javascript"> (function() { var jasmineEnv = jasmine.getEnv(); jasmineEnv.updateInterval = 1000;
var trivialReporter = new jasmine.TrivialReporter();
jasmineEnv.addReporter(trivialReporter);
jasmineEnv.specFilter = function(spec) { return trivialReporter.specFilter(spec); };
window.onload = function() { jasmineEnv.execute(); }; })(); </script>
<link href="../src/html/jasmine.css" rel="stylesheet"/></head>
<body></body></html>
![Page 81: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/81.jpg)
Test Runners :What, Where, How, When, Why
![Page 82: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/82.jpg)
Test Runners :What, Where, How, When
![Page 83: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/83.jpg)
Without tests, code won’t work
![Page 84: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/84.jpg)
Without tests, code won’t work
If writing tests is hard, they won’t get written
![Page 85: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/85.jpg)
Without tests, code won’t work
If writing tests is hard, they won’t get written
If running tests is had, they won’t get run
![Page 86: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/86.jpg)
Without tests, code won’t work
If writing tests is hard, they won’t get written
If running tests is had, they won’t get run
If tests don’t get run, they won’t get written
![Page 87: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/87.jpg)
Without tests, code won’t work
If writing tests is hard, they won’t get written
If running tests is had, they won’t get run
If tests don’t get run, they won’t get written
Without tests, code won’t work
![Page 88: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/88.jpg)
Make the simple things easyand the hard things possible
![Page 89: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/89.jpg)
DOM vs non-DOM
Synch vs Asynch
![Page 90: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/90.jpg)
Make the hard things possible
![Page 91: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/91.jpg)
Make the hard things possibleand everything else equally hard
![Page 92: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/92.jpg)
Write a testSwitch to browserLoad a test pageFind the/a failureSwitch to editorWrite codeSwitch to browserHit refreshFind the/a success
Lather, rinse, repeat
![Page 93: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/93.jpg)
This sucks
![Page 94: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/94.jpg)
Let me count the ways
![Page 95: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/95.jpg)
Load what?
![Page 96: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/96.jpg)
From where?
![Page 97: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/97.jpg)
How, i.e., with what?
![Page 98: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/98.jpg)
When?
![Page 99: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/99.jpg)
What: pick your fixture(s)
Where: run some server somewhere
How: with the browser on my desktop(repeat as necessary)
When: when I feel like it
![Page 100: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/100.jpg)
Did I mention this sucks?
![Page 101: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/101.jpg)
What: I hate fixtures
![Page 102: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/102.jpg)
They’re painful to setup
They don’t reflect the real world
![Page 103: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/103.jpg)
In vitro
In situ
In vivo
![Page 104: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/104.jpg)
Jazz: a test runner
![Page 105: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/105.jpg)
Jazz
Supports Jasmine and qunit
Supports browsers (Chrome, Firefox)Supports env.js (Ruby/SpiderMonkey)
Can run fixture-less tests
Integrates with wake
![Page 106: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/106.jpg)
Wake: make/rake + autotest/watchr
![Page 107: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/107.jpg)
Save a file, run a test
![Page 108: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/108.jpg)
Save a file, run tests
![Page 109: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/109.jpg)
Understands dependences
Integrated with jazz/envjs
![Page 110: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/110.jpg)
Records successes/failures
Re-executes: Changed files until success Failed tests until success All tests
![Page 111: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/111.jpg)
Plugin Architecture
Matching source filesResult files
DependencesSuccess/failure
![Page 112: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/112.jpg)
Plugins
haml/sassjazzjslintrbshellgraphics (inkscape, batik, rsvg)cache_manifest
![Page 113: Test and Behavior Driven Development in JavaScriptassets.en.oreilly.com/1/event/45/Test and Behavior Driven... · Asynchronous no wait no sleep no threads window.setTimeout I/O Packaging](https://reader030.vdocuments.mx/reader030/viewer/2022013014/5b24195f7f8b9ae44c8b4585/html5/thumbnails/113.jpg)
qunit: http://github.com/jquery/qunitJasmine: http://github.com/pivotal/jasmine
my fork: http://github.com/smparkes/jasminejslintrb: http://github.com/smparkes/jslintrbjazz: http://github.com/smparkes/jazzwake: http://github.com/smparkes/wakettt: http://github.com/smparkes/tttchessflock: http://github.com/smparkes/chessflock