Upload
morgan-roderick
View
2.497
Download
2
Embed Size (px)
DESCRIPTION
Citation preview
Testing JavaScriptFront Trends 2010
whoami
• Morgan Roderick, @mrgnrdrck
• Web developer
• First web page in 94, have used <blink>, <marquee>, <font> ...
• Mostly freelancing since 2001
• Currently on contract with Nokia Gate5
• Why do we write code?
• Why should we write tests?
• Getting started with Unit Tests
Todays talk
Why do we write code?
Famous fails!
• 1985-1987 Therac 25 Medical accelerator, 5 patients dead, several injured
• 1994 Intel Pentium floating point division bug (FDIV). $475M
• 1998 NASA space probe Mars Climate Orbiter burns up in atmosphere. $327.6M.
Moar famous fails
• 2000 National Cancer Institute, Panama City, radiation therapy planning software, 8 patients die, 20 severely injured
• ...
• 2010 Toyota recalls cars, est. $2B
• 2010 Twitter suffers XSS attack
Why should we test?
Pick a test framework
DOH
JsUnit
QUnit
Crosscheck
J3Unit
JSNUnit
YUI TestUnitTesting
Jasmine
screw-unit
Test.Simple
TestCase
JSTest
jsUnity
RhinoUnit
JasUnit
FireUnit
JsTestDriver
SinonJS
Pick a test framework
DOH
JsUnit
QUnit
Crosscheck
J3Unit
JSNUnit
YUI TestUnitTesting
Jasmine
screw-unit
Test.Simple
TestCase
JSTest
jsUnity
RhinoUnit
JasUnit
FireUnit
JsTestDriver
SinonJS
JsTestDriver TestCase
Testing PubSubJShttp://github.com/mroderick/PubSubJS
PubSubJS Requirements
• Subscribe to messages
• Publish messages
• Unsubscribe from messages
PubSubJS Overview
subscribe
test subscribe
unsubscribe
test unsubscribe
test unsubscribe
publish
publish contd.
test publish
test publish
test publish
test publish
Thank you
• http://github.com/mroderick/PubSubJS
• http://code.google.com/p/js-test-driver/
• http://cjohansen.no/sinon/