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

End to End Unit Testing for Web Developers

End to End Unit Testing for Web Developers

Everyone knows theyre valuable, but writing unit tests for web applications can be a major pain in the butt. Few developers truly understand the many facets of unit testing, and choosing the right tools can be problematic in itself.

In this session, Arthur Kay will examine the various ways you can test an application and offer realistic suggestions on how to integrate unit tests into your project.

Arthur Kay

April 27, 2013
Tweet

More Decks by Arthur Kay

Other Decks in Technology

Transcript

  1. What do I test? • Structure •  Code itself • Logic • 

    Assertions • Presentation •  Behavior
  2. Unit Tests Should… •  Prevent regressions •  Compliment greater testing

    process •  Imply functionality / intent •  Build confidence Should not… •  Imply no bugs exist •  Replace actual QA testing •  Test things at random •  Attempt 100% coverage
  3. Remember: •  Automation is required •  Solves a specific problem

    •  Feedback via reporting •  Not all tools integrate the same way! •  Sometimes you need to hack •  Document everything!
  4. Unit Tests: Structure • Stable code across browsers • Maintain best practices

    • Monitor performance Tools: •  JSLint / JSHint •  LintRoller •  W3C Validator •  YSlow •  CSS Lint Automation: •  Node.js •  PhantomJS •  Ant •  CI servers (Travis)
  5. Unit Tests: Logic • Write testable code! • Few (or no) DOM

    dependencies • Models • Validations • Utilities Tools: •  Jasmine •  Siesta •  100 others Automation: •  Node.js •  PhantomJS •  Testacular •  Ant •  CI servers
  6. Unit Tests: Presentation • Verify functionality or display • Components vs QA

    Tools: •  Testacular •  Siesta •  Selenium •  CasperJS Automation: •  CI servers •  PhantomJS •  Selenium RC
  7. Advice •  Pick your battles •  Weaknesses •  High-impact • 

    Some testing is better than no testing •  As long as it’s automated •  Remember the “unit” in “Unit Test” •  Solve specific problems •  Use the right tool •  “Set it and forget it”
  8. Links •  For this presentation: •  https://speakerdeck.com/arthurakay •  http://spkr8.com/s/118941 • 

    https://github.com/arthurakay/ •  Sencha Webinar on Unit Testing: •  https://vimeo.com/58665998 •  Me: •  http://www.akawebdesign.com •  http://www.twitter.com/arthurakay
  9. Review •  Unit Tests: •  Structure •  Logic •  Presentation

    •  Tests are SPECIFIC •  Tests must be AUTOMATED •  Tests need REPORTING
  10. Fin