Testing JavaScript
Front Trends 2010
whoami
• Morgan Roderick, @mrgnrdrck
• Web developer
• First web page in 94, have used <blink>,
<marquee>, <font> ...
• Mo...
• 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 poi...
Moar famous fails
• 2000 National Cancer Institute, Panama
City, radiation therapy planning software, 8
patients die, 20 s...
Why should we test?
Pick a test framework
DOH
JsUnit
QUnit
Crosscheck
J3Unit
JSNUnit
YUI Test
UnitTesting
Jasmine
screw-unit
Test.Simple
TestC...
Pick a test framework
DOH
JsUnit
QUnit
Crosscheck
J3Unit
JSNUnit
YUI Test
UnitTesting
Jasmine
screw-unit
Test.Simple
TestC...
JsTestDriver TestCase
Testing PubSubJS
http://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/
Upcoming SlideShare
Loading in …5
×

Testing javascript-fronttrends-2010

2,386 views
2,227 views

Published on

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,386
On SlideShare
0
From Embeds
0
Number of Embeds
181
Actions
Shares
0
Downloads
34
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Testing javascript-fronttrends-2010

  1. 1. Testing JavaScript Front Trends 2010
  2. 2. 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
  3. 3. • Why do we write code? • Why should we write tests? • Getting started with Unit Tests Todays talk
  4. 4. Why do we write code?
  5. 5. 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.
  6. 6. 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
  7. 7. Why should we test?
  8. 8. Pick a test framework DOH JsUnit QUnit Crosscheck J3Unit JSNUnit YUI Test UnitTesting Jasmine screw-unit Test.Simple TestCase JSTest jsUnity RhinoUnit JasUnit FireUnit JsTestDriver SinonJS
  9. 9. Pick a test framework DOH JsUnit QUnit Crosscheck J3Unit JSNUnit YUI Test UnitTesting Jasmine screw-unit Test.Simple TestCase JSTest jsUnity RhinoUnit JasUnit FireUnit JsTestDriver SinonJS
  10. 10. JsTestDriver TestCase
  11. 11. Testing PubSubJS http://github.com/mroderick/PubSubJS
  12. 12. PubSubJS Requirements • Subscribe to messages • Publish messages • Unsubscribe from messages
  13. 13. PubSubJS Overview
  14. 14. subscribe
  15. 15. test subscribe
  16. 16. unsubscribe
  17. 17. test unsubscribe
  18. 18. test unsubscribe
  19. 19. publish
  20. 20. publish contd.
  21. 21. test publish
  22. 22. test publish
  23. 23. test publish
  24. 24. test publish
  25. 25. Thank you
  26. 26. • http://github.com/mroderick/PubSubJS • http://code.google.com/p/js-test-driver/ • http://cjohansen.no/sinon/

×