Unit Tests Are Not a Substitute for Your Brain
I spent all day yesterday getting unit tests to pass.
I’d set my module to run in one of two modes, then run the test suite. I fixed all the test failures, then set my module to run in the other mode, and fixed all those failures.
Then I’d go back to the original mode, and lo! More test failures. I fixed them, then switched back to mode two. I spend the better part of the day in this loop. After lunch I realized perhaps I should step back for a moment and think about the problem. All these failures were related, and I had simply been playing whack-a-mole with test failures rather than actually thinking about the problem. Ten minutes of thinking, twenty minutes of changes, and suddenly everything worked.
I’m certainly glad we have tests to verify what I’ve done, but I’d have saved myself a lot of time if I’d not used the tests as an excuse not to use my brain.