Rspec vs. TestUnit

dhulihan picture dhulihan · Jun 17, 2011 · Viewed 17.1k times · Source

I'm beginning the planning phase of creating a testing suite for my rails 3.0.8 application. I'm trying to decide on which testing framework/gems to use. Normally I prefer to stick to Rails convention as much as possible. However, this means using TestUnit. There are many competing test frameworks to choose from that were created as an alternative to TestUnit. Has TestUnit gotten better over the years, or is it not a very good contender?

I've also heard of a lot of good things about rspec. Are rspec and TestUnit close in terms of functionality, or does rspec blow TestUnit out of the water?

Whatever framework I choose, I'd prefer it to have a good support base(lots of users and documentation), ease of use/simplicity, and a lasting future.

Answer

bor1s picture bor1s · Jun 17, 2011

Both Test::Unit and Rspec are very nice solutions. As for me I prefer to use RSpec in my Rails project - because it has many automatic solutions like autotest, highlighting syntax, shortcut commands like rake spec and other stuff that make using test easer. But in my plain ruby scripts I use Test::Unit - it is very lightweight and staightforward when you don't need complex testing (integrational and others)