Upload
dhtml
View
3.174
Download
0
Embed Size (px)
DESCRIPTION
Slides from JS Meetup Presentation "Testing JavaScript".
Citation preview
Testing JavaScript XP Methodologies
Garrett Smith Front End Engineer
What is Testing?• Testing verifies that the system does
what its supposed to
Quality
• Internal Quality - measured by the programmer
• External Quality - measured by the customer
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?
Unit Testing• A "unit" can be an ADT, an Object, or a
function
Costs of not Testing• Code debt
• Can’t refactor safely
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
Cost of Testing• Hard work and discipline
• Requires hardcore team commitment
Freedom to ChangeTests facilitate change
OK
Fixing Bugs
Test Case• Set of independent tests
• http://dhtmlkitchen.com/ape/test/tests/dom/style-f-test.html
• setUp, tearDown, template
Test Suite• APE JavaScript Library
• http://dhtmlkitchen.com/ape/test/tests/suite.html
Tools
• JSUnit
• YUI Test
• JSCoverage
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