22 Apr
2004

TDD Justifies Itself

Although I was not a quick convert to TDD,
I think I was just won over.

I am currently writing a custom task for nAnt and
am using TDD practices while doing so, running tests and refactoring ,
etc.

Here’s the meat. I have been playing with an algorithm for incrementing build numbers
in my AssemblyInfo.cs files and I cut and pasted several lines of code in this algorithm’s
function. I went back and modified the lines, but missed several mistakes on the first
pass.

Had I simply tried to debug that by running nAnt, or worse yet released that into
Technical Test, I would have chased that bug for an hour, easy. As it happened I was
able to resolve the issue fairly quickly. So I GET IT. TDD allows you to catch
hidden issues before they enter someone else’ s world. The thought of putting that
bug out in production code makes me cringe and the cost of the additional test harness
coding time just paid for itself.

Yeah, yeah, Matt. I know, I know.