test and behavior driven development in javascript
play

Test and Behavior Driven Development in JavaScript Steven Parkes - PowerPoint PPT Presentation

Test and Behavior Driven Development in JavaScript Steven Parkes smparkes@smparkes.net JavaScript means Different things to Different People <FORM NAME=FORM> <TABLE BORDER CELLPADDING=3> <TR>


  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Jasmine Test Runner</title> <script type="text/javascript"> // yes, really keep this here to keep us honest, but only for jasmine's own runner! [xw] undefined = "diz be undefined yo"; </script> <script type="text/javascript" src="../src/base.js"></script> <script type="text/javascript" src="../src/util.js"></script> <script type="text/javascript" src="../src/Env.js"></script> <script type="text/javascript" src="../src/Reporter.js"></script> <script type="text/javascript" src="../src/Block.js"></script> <script type="text/javascript" src="../src/JsApiReporter.js"></script> <script type="text/javascript" src="../src/Matchers.js"></script> <script type="text/javascript" src="../src/mock-timeout.js"></script> <script type="text/javascript" src="../src/MultiReporter.js"></script> <script type="text/javascript" src="../src/NestedResults.js"></script> <script type="text/javascript" src="../src/PrettyPrinter.js"></script> <script type="text/javascript" src="../src/Queue.js"></script> <script type="text/javascript" src="../src/Runner.js"></script> <script type="text/javascript" src="../src/Spec.js"></script> <script type="text/javascript" src="../src/Suite.js"></script> <script type="text/javascript" src="../src/WaitsBlock.js"></script> <script type="text/javascript" src="../src/WaitsForBlock.js"></script> <script type="text/javascript" src="../src/html/TrivialReporter.js"></script> <script type="text/javascript" src="suites/BaseSpec.js"></script> <script type="text/javascript" src="suites/CustomMatchersSpec.js"></script> <script type="text/javascript" src="suites/EnvSpec.js"></script> <script type="text/javascript" src="suites/ExceptionsSpec.js"></script> <script type="text/javascript" src="suites/JsApiReporterSpec.js"></script> <script type="text/javascript" src="suites/MatchersSpec.js"></script> <script type="text/javascript" src="suites/MockClockSpec.js"></script>

  2. <script type="text/javascript" src="suites/MatchersSpec.js"></script> <script type="text/javascript" src="suites/MockClockSpec.js"></script> <script type="text/javascript" src="suites/MultiReporterSpec.js"></script> <script type="text/javascript" src="suites/NestedResultsSpec.js"></script> <script type="text/javascript" src="suites/PrettyPrintSpec.js"></script> <script type="text/javascript" src="suites/ReporterSpec.js"></script> <script type="text/javascript" src="suites/RunnerSpec.js"></script> <script type="text/javascript" src="suites/QueueSpec.js"></script> <script type="text/javascript" src="suites/SpecSpec.js"></script> <script type="text/javascript" src="suites/SpecRunningSpec.js"></script> <script type="text/javascript" src="suites/SpySpec.js"></script> <script type="text/javascript" src="suites/SuiteSpec.js"></script> <script type="text/javascript" src="suites/TrivialReporterSpec.js"></script> <script type="text/javascript" src="suites/WaitsForBlockSpec.js"></script> <script type="text/javascript"> ( function () { var jasmineEnv = jasmine.getEnv(); jasmineEnv.updateInterval = 1000; var trivialReporter = new jasmine.TrivialReporter(); jasmineEnv.addReporter(trivialReporter); jasmineEnv.specFilter = function (spec) { return trivialReporter.specFilter(spec); }; window.onload = function () { jasmineEnv.execute(); }; })(); </script> <link href="../src/html/jasmine.css" rel="stylesheet"/> </head> <body> </body> </html>

  3. Test Runners : What, Where, How, When, Why

  4. Test Runners : What, Where, How, When

  5. Without tests, code won’t work

  6. Without tests, code won’t work If writing tests is hard, they won’t get written

  7. Without tests, code won’t work If writing tests is hard, they won’t get written If running tests is had, they won’t get run

  8. Without tests, code won’t work If writing tests is hard, they won’t get written If running tests is had, they won’t get run If tests don’t get run, they won’t get written

  9. Without tests, code won’t work If writing tests is hard, they won’t get written If running tests is had, they won’t get run If tests don’t get run, they won’t get written Without tests, code won’t work

  10. Make the simple things easy and the hard things possible

  11. DOM vs non-DOM Synch vs Asynch

  12. Make the hard things possible

  13. Make the hard things possible and everything else equally hard

  14. Write a test Switch to browser Load a test page Find the/a failure Switch to editor Write code Switch to browser Hit refresh Find the/a success Lather, rinse, repeat

  15. This sucks

  16. Let me count the ways

  17. Load what?

  18. From where?

  19. How, i.e., with what?

  20. When?

  21. What: pick your fixture(s) Where: run some server somewhere How: with the browser on my desktop (repeat as necessary) When: when I feel like it

  22. Did I mention this sucks?

Recommend


More recommend