The Unselfish Act of Writing Tests

Posted by Mike Blake Wed, 14 Feb 2007 21:07:00 GMT

ORUG

At this months Orlando Ruby User’s Group meeting, I did my Testing on Rails presentation. In it I touched on just some of the benefits of having an automated suite of Unit, Functional, and Integration tests.

Benefits of Testing

Later I thought of another major benefit. Tests help other people on the project, in addition to the author of the test.

Good Habits are Contagious

Recently I had the opportunity to work on a project with Harris Reynolds. Harris did something very important that sadly, you don’t see on every Rails Project. He wrote a unit test. Lot’s of us wrote tests , but this particular test stood out for two reasons. The first was when it was written.

Writing Tests First

Harris had found a bug in a model object that I had created. To notify me, he checked in an assertion that failed, then emailed me. This saved me time searching thought and remembering code I had written. I simply typed rake test:recent which runs all recently changed tests in a Rails application . The error took me right to the problem, and I immediately fixed the bug.

Testing a Deployment

The second reason I remember this test happened at least a month later. The application was being deployed to a new machine, and the test failed. The particular model object being tested pointed to a different database that the rest of the application, and it turned out that that database hadn’t been installed correctly on the new machine. Harris’s test told the problem straight away, and saved time once again.

Unit Testing: the gift that keeps on giving.

Thanks Harris!

Posted in  | Tags , , ,  | no comments

Attend a Hackfest!

Posted by Mike Blake Tue, 12 Sep 2006 14:30:00 GMT

If you’re a programmer like me you’re a little intimidated by the Hackfest. That is , you’ve had several programming gigs over the years, attended a few more day long meetings than you’d have liked, and fear that you’ll be embarrassed by your perceived lack of skill compared to the young whiz kids with a burning passion for creating software.

We’ll let me assure you, the spirit of the hackfest is one of learning and cooperation and not at all that of oneupmanship or competition. At least not at the ORUG .

I had a blast this past weekend and learned a lot from my piers, and left with the feeling that I had helped out as well.

So my advice, fear not and attend a Hackfest!

Posted in  | Tags , , ,  | 1 comment