Welcome to TSHAK.NET Sign in | Join | Help

TDD Lessons (Re)Learned

I needed to figure out if a certain API supported a piece of functionality. The first thing I did was start looking at the method implementation of that API to find the code that I was looking for. I quickly realized what I was doing wrong. What I should have been doing is looking for the test that asserts the needed functionality. Sometimes implementation code gets refactored (i.e. moved around) or is difficult to dissect at-a-glance, but the test is a simple specification stating what the software actually does. I quickly found the test and noticed something else. In my haste to meet deadlines I cheated and didn't completely cover the functionality I was looking for, even though NCover shows it as being covered. This isn't a bug in NCover, rather, it's what happens when you have a method that does more than one thing but your test doesn't test it as such. In summary, the lessons I (re)learned are:

A) Use the tests to tell you what your software does.

B) Write all code test first. Really. You're bound to miss something otherwise.

Technorati tags: ,

Published Monday, September 24, 2007 1:34 PM by tshak

Comments

No Comments
Anonymous comments are disabled