October 2025
Intermediate to advanced
673 pages
15h 55m
English
Clean tests are readable, fast, isolated, repeatable, self-verifying, timely, and designed. Readability is perhaps even more important in unit tests than it is in production code. What makes tests readable? The same things that make all code readable: clarity, simplicity, and density of expression. In a test, you want to say a lot with as few expressions as reasonable.
Consider this code from FitNesse. These three tests are difficult to understand and can certainly be improved. First, there is a terrible amount of duplicate code in the repeated calls to addPage and assertSubString. More importantly, this code is just loaded with ...
Read now
Unlock full access