automated testing
The 'what', 'when', 'why' and 'how'
“If you don’t like unit testing your product, most likely your customers won’t like to test it either.” - Anonymous
why not?
Slower feature development
It's too hard
I don't really need tests, my code is fine
QA will find my bugs
I'll do it later
Why?
Re-evaluate your code (DDT)
Plan out your code (TDD)
Slow down
Important w/ JavaScript
long-term benefits
Easier to refactor
Prevent regressions
Documentation
When?
Test Driven Development
Development Driven Testing
How?
Jasmine
Mocha
QUnit
Karma*
Spock
TestNG / JUnit
End-to-end tools
Geb
Protractor
Watir
writing testable code
Separation of concerns
Small methods
Modularization
What?
Your code
3rd-party code
Anything non-trivial
Angular
Controllers (unit)
Services (unit)
Filters (unit or e2e)
Directives & views (unit or e2e)
All of your code
/^JS[LH]int$/
JSHint vs JSlint
JSLint is less opinionated & more practical
jshint is important
For common "newbie" mistakes
For typos
example jshint warnings
simple bad references
for in
loops w/out
hasOwnProperty
no brackets around loop/conditional body
===
vs
==
hoisting issues
complexity
loops inside functions
+ 63 more
links and notes
modern.IE
/
IEVMs
defensive checks in JS
JSHint
Spock
Made with Slides.com