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

Sencha Touch TDD with Jasmine

E2238b15388c8601bb3476411b441a3c?s=47 Ricky Clegg
September 27, 2012

Sencha Touch TDD with Jasmine

A intro to using Jasmine to test Sencha Touch 2.

E2238b15388c8601bb3476411b441a3c?s=128

Ricky Clegg

September 27, 2012
Tweet

More Decks by Ricky Clegg

Other Decks in Technology

Transcript

  1. {SenchaTouchAndJasmineBDD } Unit  tes(ng  your  Sencha  Touch  applica(ons  using  the

     Jasmine   BDD  framework  and  JS  Test  Driver me@rickyclegg.com          twi0er.com/ricky_clegg         Thursday, 27 September 12
  2. The most embarrassing thing that can happen to a developer,

    is having the same bug occur twice. Thursday, 27 September 12
  3. {AreYouAProfessional?} An  expert  with  specialized   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. me@rickyclegg.com          twi0er.com/ricky_clegg         Thursday, 27 September 12
  4. {HandleWithCare?} me@rickyclegg.com          twi0er.com/ricky_clegg      

      SoAware  is  one  of  the  most  fragile  systems. There   are  not  many  careers   where   you   are  change  one  character   and  bring  down  an  en(re  system. Thursday, 27 September 12
  5. Accounting is another fragile profession. One wrong number can affect

    every other calculation on financial statements. Thursday, 27 September 12
  6. {Double-EntryBookkeeping} me@rickyclegg.com          twi0er.com/ricky_clegg      

      A  double-­‐entry  bookkeeping  system  is  a  set  of  rules  for  recording   financial   informa;on   in   a   financial   accoun;ng   system   in   which   every   transac;on   or   event   changes   at   least   two   different   nominal  ledger  accounts. Thursday, 27 September 12
  7. You may be wondering where this is all leading. Software

    engineering has its own double-entry bookkeeping... Thursday, 27 September 12
  8. {TestDrivenDevelopment} me@rickyclegg.com          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. The  Clean  Coders  have  3  rules  to  live  your  life  by. Thursday, 27 September 12
  9. Rule 1 You are not allowed to write any production

    code unless it is to make a failing unit test pass. Thursday, 27 September 12
  10. Rule 2 You are not allowed to write any more

    of a unit test than is sufficient to fail; and compilation failures are failures. Thursday, 27 September 12
  11. Rule 3 You are not allowed to write any more

    production code than is sufficient to pass the one failing unit test. Thursday, 27 September 12
  12. {WhatsUp?} me@rickyclegg.com          twi0er.com/ricky_clegg      

      Array.prototype.indexOf = function(item){ var i = this.length; while (--i) { if (item === this[i]) { return i; } } return -1; } Thursday, 27 September 12
  13. {TheRightToolsForTheJob} me@rickyclegg.com          twi0er.com/ricky_clegg      

      Jasmine  is  a  behaviour-­‐driven   development  framework  for  tes;ng   JavaScript  code.  It  does  not  depend   on  any  other  JavaScript  frameworks. It  does  not  require  a  DOM.  And  it   has  a  clean,  obvious  syntax  so  that   you  can  easily  write  tests. Thursday, 27 September 12
  14. {WorkingInTheRightEnvironment} me@rickyclegg.com          twi0er.com/ricky_clegg      

      Jet  Brains  -­‐  WebStorm  is  the   best  JavaScript  IDE   on  the  planet  * JS   Test   Driver   a   cross   browser   tes;ng   environment  comes  built  in. 1000’s  of  plugins. Code   refactoring   tools   including   method   extrac;on,  rename,  move  and  introduce  variable. Local  GIT  support. *This  could  well  just  be  my  opinion. Thursday, 27 September 12
  15. Demo... Thursday, 27 September 12

  16. {DifferentTypesOfTesting} me@rickyclegg.com          twi0er.com/ricky_clegg      

      Unit  tes(ng  is  for  tes;ng  business  logic   only. Integra(on  tes(ng  is  for  tes;ng  unit  tests   working  in  a  group. In  a  Sencha  app  there  is  very  li0le   business  logic.  We  use  UI  tes(ng  to  test   our  views. For  UI  tes;ng  and  there  is  no  be0er  tool   for  this  than  Siesta. Thursday, 27 September 12
  17. {Links} Web  Storm JsTestDriver Jasmine Jasmine  JSTD  Adapter Clean  Coders

    Sencha Siesta me@rickyclegg.com          twi0er.com/ricky_clegg         h0p://www.jetbrains.com/webstorm/ 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://www.sencha.com h0p://bryntum.com/products/siesta/ Thursday, 27 September 12
  18. {Questions?} me@rickyclegg.com          twi0er.com/ricky_clegg      

      Thursday, 27 September 12