How They Work
At their heart, unit tests are pretty simple. Whenever you add any new functionality to the system, you write a test for it.
Take this new tax-rate lookup feature Dave and his team added to the system. It looks up your tax rate based on the region of the country you live in.
Now when you look at this code, what sort of test cases come to mind?
This is what we do when we write unit tests. We look at a particular class, see what methods it describes, and decide what kinds of tests we’d like to write.
Get The Way of the Web Tester now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.