It’s now 6:30am here in Austin, TX and my first forays into TDD have paid their first real dividends.
Roy Osherove (http://weblogs.asp.net/rosherove/) and I spent a couple of hours yesterday going over my system framework/architecture, installing nUnit and Test Driven.NET. We wrote one very simple contrived test and then left for BBQ with our bud Scott Bellware.
So it’s 4:00 am and I cannot sleep so I get up, do some client work and then return to so some tests on my own. So I refactored my customer business object. I added a rule to check that the last name is filled in. Then I wrote another test. The goal of this test was to make sure my validation engine worked and returned the proper error conditions.
So I ran the test and it failed. I’m like what? This should have worked. Why didn’t my rule(s) fire? So I looked into the framework code and low and behold. Looks like I never finished wiring in our new validation rules engine.
BINGO: Dividend 1 paid. We now need to finish wiring in the new validation engine.
So now I returned to making the test pass. I had a hook point where I could wire in manual calls to the validation engine. So I did that and restarted the test. Boom another failure. Now what happened? We have a set of code the integrity of the data being returned. Well when we have a data validation error we don’t return that data. Nice thing is that this section of the application is created via code-gen. I simply changed the script to test for the error condition. Now our test passed.
BINGO: Dividend 2 paid. We needed to fix some of our codegen templates.
So with just a few simple tests I found two very significant bugs in our framework. It’s nice to see that this stuff pays off so quickly.
The nice thing is that now I am confident that this stuff pays great dividends (and very quickly I might add). Also it’s great to see that it CAN be implemented against our framework.
crossposted from blog.dashpoint.com