开发者

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 :

  • Use of watir (love it)
  • Easy to learn
  • Do not mess with the application (like Rspec generator - not against rspec)
  • Integratio开发者_开发百科n with rails 3
  • No clients will have to read it, only dev.

What do you think ?


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.


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


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!


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜