harriyott.com

Unit testing is wonderful

Unit testing is just plain inspired. In the old days, developers didn't really like testing. Someone must have had the idea that developers would like testing if they could do it by writing code. Testing code by writing code? Sounds far fetched, but it works.

I'm using NUnit and TestDriven.NET, and it has saved me some time and effort already. I used the Whidbey refactoring tool to extract a method, and lots of tests suddenly failed. The problem was with an original private member which should have been a parameter, but wasn't. I made it a parameter, and all the tests worked. I don't know how long that would have taken to locate without the tests.
22 February 2005