Friday, August 3, 2007

Unit Testing

I started unit testing for my project at work today. A unit test is a program that goes through your program line-by-line, following every branch and conditional. Unit tests aren't simple to write, especially when you're trying to cover unusual conditions or large functions. I was dreading these tests, but they've actually been really fun so far. I think it's because I'm no longer just reading code or translating it. I'm actually writing it from scratch. I have much more freedom, plus it's kind of like a game to try to get 100% coverage of the code. Maybe I'll get sick of it in a while, but for now I'm enjoying it a lot. For my next project, I'd like to try writing the unit tests as I develop the code. That's more of an extreme programming approach.

No comments: