On unit testing

Michael Tsai responds to Will Shipley’s now infamous Unit testing is teh suck, Urr.
Here’s one important aspect of TDD Michaels well-balanced post is not elaborating enough:
Unit-Testing is about design (& specification of behaviour) as much as about testing, as many proponents of TDD point out (check Dave Astels blog who’s taking this aspect of TDD to the extreme).
While I’m at it, Michael states:

If you need a new class or method, I think it’s a waste of time to write a test that simply checks for the existence of the class or method, then write a stub, then run the tests, and then then flip back and write the real tests.

I beg to differ. If you intend to write a unit test anyway, there’s no time wasted doing it with tiny little steps like mentioned above – in fact, I would argue to use the tiniest steps possible, asking the compiler/linker/runtime for help as much as possible). Plus, it saves precious spare brain cycles for those really hard problems. Of course, you’re smarter than me, so you probably have brain cycles to spare ­čÖé

Comments are closed.