So who wants to hear
another testing talk?
Ok so who is developing
TDD or test first?
DOM code?
Hi I am Phil, and I'm a
Developer...
@sideshowcoder (github) @ischi (twitter)
working for Cospired
Javascript frontend
testing
from failure to good to great
TDD for DOM is hard
right?
Either they are slow
TDD fast feedback loop with capybara
anyone?
Or they can't test what I
need!
function addFive(x) { return x + 5 }
... is not what I do day to day
They are hard to setup
1 hour project 2 hour setup?
What about CI integration?
But I want to testdrive my
code!
because my code is better when I do
Ok so lets see is it really
so hard?
lets walk through a simple example
DEMO
https://github.com/sideshowcoder/frontend-
tdd-with-jasmine
Yeah I know just some
jQuery...
but I hope it shows some principles
Breaking code up by
responsibility
Small modules enable reuse
*do one thing and do it well!*
Be aware of your
dependencies
On which parts of the DOM do I rely on?
Which other plugins do I need?
Changes are easier
Everything has it's place
And I got some
confidence that it does
what it says it does*
*different from 'it does what I want it to do'
but it's a start!
Tests can be integrated in
CI
rake jasmine:ci
They can be run
headlessly
phantom-jasmine, jasmine-guard, jasmine-
headless-webkit
So yes it is possible to
TDD frontend code
IMHO
Questions?
And thank you all for listening!

JavaScript frontend testing from failure to good to great