Hartator
Hartator

Reputation: 5145

Testing Framework for Rails 3?

We actually do not use test within our application (I know that's bad and sad). I have reads a lot about Test::Unit, Shouda, minitest and the new one Bacon. But cannot make my mind yet. Basically our needs are :

What do you think ?

Upvotes: 0

Views: 532

Answers (4)

Caley Woods
Caley Woods

Reputation: 4737

I would recommend Test::Unit/Minitest along with the others here. You can also install Shoulda or use something like this to provide Test::Unit with syntax like so:

class TestStuff < Test::Unit::TestCase
  def setup
    @foo = Klass.new
  end

  should "be of class Klass" do
    assert_equal Klass, @foo.class
  end

end

Have you thought of using Capybara instead of Watir?

Upvotes: 0

Mark
Mark

Reputation: 1068

I would go for minitest as its the default in Ruby 1.9.2 (replacing test/unit) and use the test/unit format as it's something that a lot of developers are familiar with

Upvotes: 2

d11wtq
d11wtq

Reputation: 35308

I actually abandoned Test::Unit and switched to RSpec 2. Only developers have to read our tests, but RSpec seems to encourage better structured tests than Test::Unit. It's different to most other testing frameworks though, so there's a small learning curve, but only for the first few days.

I also strongly advise that you don't use Rails' fixtures and you take a look at Machinist.

Upvotes: 2

Summit Guy
Summit Guy

Reputation: 305

Your last bullet point leads me to recommend Test::Unit. If you don't need the tests to be client readable, Test::Unit is much more straightforward, and doesn't require as much knowledge of the test framework before you can get started. It looks like it integrates with Watir (although I haven't used it for that).

I'm sure you'll get lots of suggestions for each of the frameworks you listed, I'd say just pick one and start writing tests!

Upvotes: 1

Related Questions