I Like Unit Testing
Posted At : July 7, 2008 6:15 AM | Posted By : Bob Silverberg
Related Categories: MXUnit, ColdFusion, TDD
I never imagined that I'd say those words, but they're true. I must start by admitting that I wrote my first unit test a few days ago. I know, I'm bad, I should have been doing this for years. I've known about unit testing for a long time, I've been reading more and more about it, and listening to speakers at conferences extol its virtues. But somehow I just couldn't get my a$$ in gear. It just seemed like too much extra work. And as a sole developer working on relatively small projects I was able to get away with not doing it.
Anyway, I read a blog post a few days ago that inspired me to take the plunge. The post describes unit testing with CFUnit, but I'd been hearing a lot of good things about MXUnit, so I decided to give that a try.
I started by visiting the MXUnit Home Page, and went through steps 1 and 2, which I was able to complete without a hitch. I now had the framework and the Eclipse Plugin installed. I then visited the docs, and worked my way through the Base Tutorials. Within an hour I was up and running and writing my first real unit test. Kudos to the MXUnit team for a great product, and such clear and concise documentation.
The biggest surprise for me is just how much I enjoy unit testing. I guess it's more the whole process of Test-driven development (TDD) that I enjoy, but I do also like writing the tests themselves. It's like a whole new realm of problem solving has been opened up to me. I'm also already seeing how much time I'm saving this way - it's truly amazing.
I think I also found it easy to get started as I had one component that I decided to unit test. It was a nice, small place to start, and relatively easy to test.
So my advice to anyone else who's on the fence as I was; find a small component, give yourself a few hours to really get started, and you too may find that unit testing isn't painful at all.
The point about "starting small" cannot be stressed enough.
(p.s. the check's in the mail).
marc
http://mxunit.org
http://rocketunit.riaforge.org/