Test-Driven Development with Rails Studio

Posted by chris
on Friday, October 19

I recently returned from the Pragmatic Studio's Test-Drive Development with Rails studio. I've been to several Pragmatic Studios, and have come to expect very high quality instructions from people who know what they're doing and are actually using the stuff they are teaching - the TDD studio definitely lived up to my expectations. The instructors were Joe O'Brien and Jim Weirich (of rake, rubygems, and flexmock fame).

I'm a bit ashamed to admit I have not been much of a tester in my Rails development thus far. I've always recognized the value behind testing, but just hadn't had the impetus to really get me going. The main reason for me attending this studio was to provide the kick in the ass to get me started with testing... and it succeeded.

The first two days covered traditional Rails unit and functional testing, while the third covered rspec. The best parts, in my opinion, were the pair-programming live code demos put on my Joe and Jim. In the demos, Joe would write the test while Jim would implement the code for that test. It really cemented in my mind the idea behind Red (initial failing test), Green (passing test), Refactor (cleanup and refactor code).

We also covered some other really cool technologies like cruisecontrol.rb (a tool for continuous integration) and Selenium and FireWatir (tools for automating testing in the browser).

Now that I've seen some real-life TDD, I'm looking forward to incorporating it into my own development practices.