SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
Cover the advantages of test driven development, the reasons for pushing it all the way to the browser level, and then explore the options for testing JavaScript, look at some examples, and then integrate the tests into our existing development workflow.
Cover the advantages of test driven development, the reasons for pushing it all the way to the browser level, and then explore the options for testing JavaScript, look at some examples, and then integrate the tests into our existing development workflow.
37.
Testing the DOM
Verify JS is doing what we expect to the HTMLs
38.
Testing the DOM
In suite.html (container file), have a special DOM node:
In a before block, set it to it’s default state:
39.
Testing the DOM
In your specs, you can interact with it:
40.
Always more to explore...
Mocking and Stubbing - using the Smoke library
Testing / simulating browser events
Testing / mocking ajax requests and callbacks
41.
Integrate with your workflow
An example using Blue Ridge for Ruby on Rails
42.
Blue Ridge
A JavaScript Testing plugin for Rails
Run JavaScript tests via the command-line, with a
head-less browser environment
Uses Rhino - a Java based JavaScript interpreter
And env.js - an implementation of the DOM in pure
JavaScript (thanks John Resig!)
Screw.Unit and Smoke built in! Plus generators.
http://github.com/relevance/blue-ridge
43.
Always be testing
Run your JS tests at the same time as your
other tests!
Example...
44.
A universe of browsers
each with its own “features” (bugs)
45.
JS Test Driver
Parallel cross-browser testing via command line
46.
JS Test Driver
http://code.google.com/p/js-test-driver/
Launch the server
Capture one or more browsers
Write tests and code
Run your tests
Bonus: Continously run tests, whenever files change
47.
Future / Other
Test Swarm: Distributed Continous Integration for JS
http://testswarm.com
JSpec: An alternative BDD framework for JS
http://visionmedia.github.com/jspec
48.
Thanks!
Scott Becker
becker.scott@gmail.com
http://synthesis.sbecker.net