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 ...
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