11
Cucumber and RSpec are worth a look. They encourage testing in a behaviour-driven, example-based style.
RSpec is a library for unit-level testing:
describe "hello_world"
it "should say hello to the world" do
# RSpec comes with its own mock-object framework built in,
# though it lets you use others if you prefer
world = mock("World", :population => 6e9)
world.should_receive(:hello)
hello_world(world)
end
end
It has special support for Rails (e.g. it can test models, views and controllers in isolation) and can replace the testing mechanisms built in to Rails.
Cucumber (formerly known as the RSpec Story Runner) lets you write high-level acceptance tests in (fairly) plain English that you could show to (and agree with) a customer, then run them:
Story: Commenting on articles
As a visitor to the blog
I want to post comments on articles
So that I can have my 15 minutes of fame
Scenario: Post a new comment
Given I am viewing an article
When I add a comment "Me too!"
And I fill in the CAPTCHA correctly
Then I should see a comment "Me too!"
You can also test out the web interface with a Firefox plug-in such as http://selenium.openqa.org/
It will record clicks and text entry and then plays back and will check the page for the correct display elements.