Lilypie 3rd Birthday Ticker

Tuesday, June 12, 2007

Unit Testing


I've embarked on a new journey at work and it has me kind of excited.

I spend alot of time 'debugging' and re-writing code that our testers find problems with - mostly stuff that I've spent alot of time on previously. Stuff that I didn't test thoroughly enough and its mostly due to the fact that I don't really know how to test outside of integration testing. I'm not alone in this 'problem' though - lots of programmers are like that.

So, after much discussion with all the programmers, we're implementing Unit Testing w/ NUnit.

Today I spent 3 hours unit testing one of my importers. 2 of those hours was spent trying to figure out why .NET's minimum date is: 01/01/0001 (aka January 1, 1 AD) yet SQL Server which stores the data I'm trying to read has a minimum date of: 01/01/1753 (um, random year??). So I had to write some code that would check that the date was greater than 1/1/1753. Yet, like any good programmer, I tried to do this without having to re-write too much of what was already existing.

Big mistake. 2 hours later I'm cursing and throwing my headphones on my desk and walking out to get some air.

Yes, I finished it. Yes, I stayed 45 minutes later at work as I wasn't going to leave without this VERY simple task being completed.

My review is coming up... I'm sure this will be on it. sigh

No comments: