Run All the Tests

It's most important that the code does what it has to do. In XP, there is only one way to know whether the code does what it has to do: there must be a test. A feature does not exist unless there is a test for it.

Does this mean that every class must have tests? Not necessarily, but it wouldn't hurt. If a class has no behavior that could possibly break, then it doesn't need tests. If it could possibly break, test it.

What if another class uses ours, and the other class has tests? Does our class need tests? More likely than not, it does. Does the test for the other class test every feature of our class? Probably it does not. Will our class ever need enhancement or clarification or optimization? Probably it will. Changing our ...

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.