© Jennifer M. Kohnke
Fire is the test of gold; adversity, of strong men.
—Seneca (c. 3 B.C.–A.D. 65)
The act of writing a unit test is more an act of design than of verification. It is also more an act of documentation than of verification. The act of writing a unit test closes a remarkable number of feedback loops, the least of which is the one pertaining to verification of function.
Suppose that we followed three simple rules.
- Don’t write any production code until you have written a failing unit test.
- Don’t write more of a unit test than is sufficient to fail or fail to compile.
- Don’t write any more production ...