Ian's Blog

Unit Tests Are Not a Substitute for Your Brain

leave a comment »

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.


Written by Ian Olsen

April 17, 2009 at 8:10 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: