Advice for tests

Hallo.
I’m using rails with jruby for my applications but until now I never
used tests.
Now I want start to integrate tests during my applications development.
Do you suggest some suites or frameworks to automate and facilitate
tests?
I’ve heard of selenium http://seleniumhq.org.
What do you think about?

On 24 Aug 2010, at 10:48, Mauro wrote:

I’m using rails with jruby for my applications but until now I never
used tests.
Now I want start to integrate tests during my applications
development.
Do you suggest some suites or frameworks to automate and facilitate
tests?
I’ve heard of selenium http://seleniumhq.org.
What do you think about?

Basically there’s two to three tiers of tests you’d want to look into:

  • unit tests: testing models on a microlevel, making sure that your
    models behave and will keep behaving as you intend them to. Personally
    I prefer RSpec for these tests, the syntax feels natural to me.
    However, you could also use Test::Unit with Shoulda. There’s probably
    some other options available, but these two are going to be the most
    popular ones.

  • integration tests: testing controllers and the actual application
    behavior. Now this is where Selenium comes in. Unless your Rails app
    makes extensive use of clientside technology (i.e. Javascript and AJAX
    requests), you probably don’t need Selenium. Don’t use Selenium as a
    way to press a record button and go through your application manually
    and then replay that every now and then. We use Cucumber+Selenium for
    our application because quite a bit of the functionality is clientside
    code. If that weren’t the case, Cucumber by itself would be more than
    enough. You basically write different scenarios and then run them.

  • performance tests: here you will tests the performance of your Rails
    app. Personally I’ve never needed to use them, so maybe someone will
    chime in here on what solutions are available.

Peepcode.com has some really nice screencasts available on testing.

Best regards

Peter De Berdt

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs