Watir on Rails Plugin

This project provides a plugin to make it easier to write Watir (Web Application Testing in Ruby) tests for Rails applications. Watir on Rails supports both IE and Safari.

Dependencies: gem install [safari]watir

Installation: ./script/plugin install svn://rubyforge.org/var/svn/watir-on-rails

Generating Tests: ./script/generate watir SuccessfulLogin

Running Tests: ./script/server -e test and rake test:watir

Example:

require File.dirname(__FILE__) + '/../test_helper'

class SuccessfulLoginTest < Test::Unit::TestCase
  include WatirOnRails

  # Defaults to localhost:3000
  server "10.2.32.142"
  port 8053

  fixtures :users

  def test_successful_login
    browser = open_browser
    browser.goto("/login")
    name = users(:dave).name
    browser.text_field(:name, "user[name]").set(name)
    browser.password(:name, "user[password]").set("test")
    browser.button(:name, "login").click
    assert_select "div#banner", /Welcome #{name.capitalize}/
    browser.close
  end
end


Brought to you by Dave Hoover.