DHH Offended By RSpec, Says Test::Unit Is Just Great

By Peter Cooper

As an outspoken and opinionated guy, David Heinemeier Hansson (a.k.a. DHH), creator of Rails, is no stranger to a little bit of controversy. He frequently sets off interesting debates on Twitter from his @dhh account. The latest is, perhaps, the most involved yet and has been rattling on for a couple of hours today.

So what's the beef? RSpec and Cucumber versus.. Test::Unit. It's no secret that DHH is a happy Test::Unit (and fixtures) user. Last October he tweeted:

But here's what kicked off today's debate:









Naturally, this brought a plethora of heckles, support, snark, and questions from DHH's followers, including:









More specifically, though, DHH noted that this gist comparing some Test::Unit tests to RSpec triggered his statements.

But back to the debate. JD Skinner asked: What testing tools do you use/recommend? DHH replied:

Jeremy Welland asked: So why do you think RSpec/shoulda's approach is so popular? DHH's response:

The debate rattled on for a few hours amongst various Ruby developers on Twitter (including Dave Thomas and Bryan TATFT Liles) and if you want to really dig into it, check out DHH's Twitter account and follow through some of the responses.

I agree with DHH for the most part, though I use a mixture of RSpec, Test::Unit, and Minitest just to "keep my hand in." RSpec (and BDD) did seem to become "the way" to do testing in many circles, though, even when it didn't present any significant benefits. Cucumber, following on from RSpec, had a similar experience.

This debate is important, though, not because DHH is right or wrong or because one testing system is better than another, but because it wipes away some of the lines in the sand and assumed "correct way" attitudes that exist. If you want to use Test::Unit, it's not "old and uncool" (yes, I've heard this) and you should get on with it (DHH is using it fer chrissakes.) Likewise, RSpec and Cucumber are not panaceas or catch all solutions but may have significant benefits you can take advantage of.

Research your options and pick the tool that makes sense for you and your team. DHH has and he's sticking with Test::Unit. What's your take on it?

Update: DHH recommends this post about testing which suggests you check out Test::Unit first before considering more extensive frameworks. A good read!