Is Test::Unit still relevant in rails? Is Test::Unit still relevant in rails? ruby ruby

Is Test::Unit still relevant in rails?


The world has changed! Check down and upvote @prusswan

I think Test::Unit is still relevant even though there is a lot of hype surrounding BDD and other testing tools.

That being said, if you are up for it, you could bypass learning Test::Unit and start with something like RSpec and Shoulda right away, but there is something to be said about following through the examples in the Agile Web Development Book to see where the ideas from BDD came from.

I find myself still using Test::Unit for some projects since it comes with Rails and is still a very great testing framework.

So long story short, I don't think it's obsolete but it's not the cutting edge any more. BDD is a testing paradigm shift especially if you start using Cucumber and Webrat, but it's fantastic once you get into it. Shoulda is the easiest to make the transition to, so I would start with Test::Unit, then move to Shoulda, then Give RSpec and Cucumber a try.

You are testing or at least interested in testing! That's the best part. In the end it doesn't matter what you use as long as you are happy with it.

Good luck!


Just thought I would post an update from 2012:

Out of the three main and current (usable with Rails 3.2 with no more than some minor modifications) introductory books on RoR, two of them are using Rspec (with at most a short mention for Test::Unit) and one of them is planning on even moar Rspec for the next edition, so it is clear who would be the winner of this "battle" for now

And allow me to selectively quote dhh:

The important thing is of course that we get people testing, so tools shouldn't matter too much.

Revisit in 2014:

Minitest has now superceded Test::Unit as a default in the current versions of Rails. Personally I feel it deserves a closer look compared to its predecessor for a number of reasons -

  1. Its status as a default
  2. Better support for capybara and selenium, a large part due to gems like this
  3. Relatively lightweight
  4. Mostly backward compatible with Test::Unit