Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Testing JavaScript

3,467 views

Published on

Slides from JS Meetup Presentation "Testing JavaScript".

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Testing JavaScript

  1. 1. Testing JavaScript XP Methodologies Garrett Smith Front End Engineer
  2. 2. What is Testing? • Testing verifies that the system does what its supposed to
  3. 3. Quality • Internal Quality - measured by the programmer • External Quality - measured by the customer
  4. 4. Types of Testing • Unit Testing • Acceptance Testing • Internal Quality - is it easy to maintain? How hard is it to make changes? • External Quality - does it do what it's supposed to?
  5. 5. Unit Testing • A "unit" can be an ADT, an Object, or a function
  6. 6. Costs of not Testing • Code debt • Can’t refactor safely
  7. 7. Benefits • Tests facilitate change • Good coverage ensures that all code paths work • Tests make the code easier to understand • Testability leads to cleaner code; microformats
  8. 8. Cost of Testing • Hard work and discipline • Requires hardcore team commitment
  9. 9. Freedom to Change Tests facilitate change OK
  10. 10. Fixing Bugs
  11. 11. Test Case • Set of independent tests • http://dhtmlkitchen.com/ape/test/tests/dom/ style-f-test.html • setUp, tearDown, template
  12. 12. Test Suite • APE JavaScript Library • http://dhtmlkitchen.com/ape/test/tests/ suite.html
  13. 13. Tools • JSUnit • YUI Test • JSCoverage
  14. 14. Further Reading • Agile Software Development: Principles, Patterns and Practices, Robert C. Martin • Architecture is a Second Order Effect, http://blog.objectmentor.com/ articles/2007/10/20/architecture-is-a-second-order-effect • Re: Simples Rules make creating Big Balls of Mud impossible. http:// coding.derkeiler.com/Archive/General/comp.object/2007-01/ msg00241.html • http://en.wikipedia.org/wiki/Code_coverage • http://www.objectmentor.com/omSolutions/agile_xp_differences.html • Extreme programming explained: Embrace Change By Kent Beck • Planning Extreme Programming, Beck, Fowler, Kohnke

×