Upgrade to Pro — share decks privately, control downloads, hide ads and more …

JavaScript TDD

Ricky Clegg
October 17, 2012

JavaScript TDD

A introduction to testing JavaScript with TDD using JS Test Driver.

Ricky Clegg

October 17, 2012
Tweet

More Decks by Ricky Clegg

Other Decks in Technology

Transcript

  1. {JavaScriptTDD} Test  Driven  Development  is  the  difference  between  good  

    developers  and  GREAT  developers [email protected]          twi0er.com/ricky_clegg         Monday, 15 October 12
  2. The most embarrassing thing that can happen to a developer,

    is having the same bug occur twice. Monday, 15 October 12
  3. {AreYouAProfessional?} An  expert  with  specialised   knowledge  in  the  field

     which  one  is   prac;cing  professionally. A  rou=ne  which  you  do  not  waver   from. Never  causing  harm  in  the  work  they   are  doing. [email protected]          twi0er.com/ricky_clegg         Monday, 15 October 12
  4. {WhatsUp?} [email protected]          twi0er.com/ricky_clegg      

      Array.prototype.indexOf = function(item){ var i = this.length; while (--i) { if (item === this[i]) { return i; } } return -1; } Monday, 15 October 12
  5. {KentBeckSaid: ‘“Let there be light”. And there was light’} [email protected]

             twi0er.com/ricky_clegg         Kent  Beck  is  credited  with  crea;ng  Test  Driven  Development  back   in  2003. Monday, 15 October 12
  6. {TestDrivenDevelopment} [email protected]          twi0er.com/ricky_clegg      

      TDD  is  the  discipline  of  wri;ng  code  (Test  suites)  that  tests  your   produc;on  code  works. The  individual  tests  are  known  as  unit  tests. Monday, 15 October 12
  7. {TooManyChefs?} [email protected]          twi0er.com/ricky_clegg      

      Suitest JSUnit Enhance  JS QUnit Crosscheck J3Unit   Mocha JSNUnit YUI  Test JSSpec UnitTes=ng JSpec Jasmine screw-­‐unit Test.Simple Test.More TestIt jsUnitTest JSTest JSTest.NET jsUnity FireUnit Js-­‐test-­‐driver Js-­‐test-­‐runner Sinon.js SOAtest Monday, 15 October 12
  8. {BrowserPanicException} Tes;ng  on  lots  of  browsers  is  a  problem  with

     most  tes;ng   frameworks,  and  there  are  not  many  ‘One  Click’  solu;ons. [email protected]          twi0er.com/ricky_clegg         Monday, 15 October 12
  9. {DOMInsertion} [email protected]          twi0er.com/ricky_clegg      

      /*:DOC <form name="input" action="form.asp" method="get"> Username: <input type="text" name="user"> <input type="submit" value="Submit"> </form>*/ You  can  also  insert  HTML  and  create  variables. /*:DOC password = <form> Password: <input type="password" name="pwd"> </form>*/ Monday, 15 October 12
  10. {Extendable} [email protected]          twi0er.com/ricky_clegg      

      Adapters  for  some  of  the  biggest  tes;ng  libraries.  Allowing  you  to  keep   your  fluid  workflow  but  with  the  library  that  suits  your  product. Monday, 15 October 12
  11. {Links} Web  Storm Eclipse JsTestDriver Jasmine Jasmine  JSTD  Adapter Clean

     Coders JavaScript  TDD [email protected]          twi0er.com/ricky_clegg         h0p://www.jetbrains.com/webstorm/ h0p://www.eclipse.org h0p://code.google.com/p/js-­‐test-­‐driver/ h0p://pivotal.github.com/jasmine/ h0ps://github.com/ibolmo/jasmine-­‐jstd-­‐adapter h0p://www.cleancoders.com h0p://tddjs.com Monday, 15 October 12