Does This Mean to Test Every Object and Every Method?

The rule is to test everything that could possibly break. To save time, don't test things that couldn't possibly break. There are more things that couldn't possibly break than you might imagine.

Start conservatively on identifying things not to test. Until you're sure, test. But unit testing is "white box" testing. You look at the code when you write the test, and if the code can't break, then don't test it.

Accessors can't break. There's no need to test them. Unless, of course, you have a tendency to forget to write them, and no other test is going to find that they're missing. But wait—if no other test is going to access them, they shouldn't be there anyway. So probably you don't need to ...

Get Extreme Programming Installed 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.