Getting Started
Testing an existing piece of software holds a different set of challenges from testing something you are writing, particularly if it is of any size. The Timepicker Addon had just over 2100 lines of code when I started.
You first need to choose where to start. Testable entities—functions in JavaScript—that have few or no dependencies, provide you a way to start with something simpler—a way to get a foothold—and work your way up the chain. The first commit, of course, was just setting up the test framework [72007f6].
I chose to start with a series of top-level private functions within the immediately invoked function expression (IIFE) that wraps every well-written jQuery plugin. But the functions were private, so I had to decide ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access