Photo from Chile

I Like Unit Testing

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.

that's awesome, bob!

The point about "starting small" cannot be stressed enough.

(p.s. the check's in the mail).

# Posted By marc esher | 7/7/08 8:15 AM
Thanks Marc, although I'd prefer a cheque ;-)
# Posted By Bob Silverberg | 7/7/08 10:46 AM
checkout rocketunit. out of all i've played with, rocketunit is by far the easiest and most straight forward.
# Posted By dfguy | 7/7/08 1:00 PM
Damnit, Bob, not you too?!?! I get enough guilt-trips already, thank you very much. Seriously though, I guess I'm going to have to give in one of these days and start doing it myself as well. Like you, I've been on the fence a long time. Your post might just be enough to get me to jump off.
# Posted By Matt Quackenbush | 7/7/08 6:02 PM