2008-11-25 00:59:27 +00:00
|
|
|
= Webrat - Ruby Acceptance Testing for Web applications
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 15:15:39 +00:00
|
|
|
- http://gitrdoc.com/brynary/webrat
|
2008-11-25 01:27:52 +00:00
|
|
|
- http://groups.google.com/group/webrat
|
|
|
|
- http://webrat.lighthouseapp.com/
|
|
|
|
- http://github.com/brynary/webrat
|
2008-04-04 14:33:34 +00:00
|
|
|
|
2008-11-25 00:59:27 +00:00
|
|
|
== Description
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
Webrat lets you quickly write expressive and robust acceptance tests for a Ruby
|
|
|
|
web application.
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
== Features
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
* Browser Simulator for expressive, high level acceptance testing without the
|
|
|
|
performance hit and browser dependency of Selenium or Watir (See Webrat::Session)
|
|
|
|
* Use the same API for Browser Simulator and real Selenium tests using
|
|
|
|
Webrat::SeleniumSession when necessary (eg. for testing AJAX interactions)
|
|
|
|
* Supports multiple Ruby web frameworks: Rails, Merb and Sinatra
|
|
|
|
* Supports popular test frameworks: RSpec, Cucumber, Test::Unit and Shoulda
|
|
|
|
* Webrat::Matchers API for verifying rendered HTML using CSS, XPath, etc.
|
2008-03-03 00:55:22 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
== Example
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
class SignupTest < ActionController::IntegrationTest
|
|
|
|
|
|
|
|
def test_trial_account_sign_up
|
|
|
|
visit home_path
|
2008-10-25 15:38:23 +00:00
|
|
|
click_link "Sign up"
|
|
|
|
fill_in "Email", :with => "good@example.com"
|
|
|
|
select "Free account"
|
|
|
|
click_button "Register"
|
2008-04-28 08:37:10 +00:00
|
|
|
end
|
2008-11-25 04:30:10 +00:00
|
|
|
|
2008-11-25 00:59:27 +00:00
|
|
|
end
|
2008-11-25 04:30:10 +00:00
|
|
|
|
|
|
|
Behind the scenes, Webrat will ensure:
|
2008-10-21 05:06:49 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
* If a link, form field or button is missing, the test will fail.
|
|
|
|
* If a URL is invalid, the test will fail.
|
|
|
|
* If a page load or form submission is unsuccessful, the test will fail.
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
== Install for Rails
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
To install the latest release as a gem:
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
sudo gem install webrat
|
2008-04-04 14:44:50 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
To install the latest code as a plugin: (_Note:_ This may be less stable than using a released version)
|
|
|
|
|
|
|
|
script/plugin install git://github.com/brynary/webrat.git
|
|
|
|
|
|
|
|
In your test_helper.rb, spec_helper.rb, or env.rb (for Cucumber) add:
|
|
|
|
|
2008-12-09 05:19:44 +00:00
|
|
|
require "webrat"
|
|
|
|
Webrat.configure do |config|
|
|
|
|
config.mode = Webrat::Configuration::RAILS_MODE
|
|
|
|
end
|
2008-04-04 14:44:50 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
== Install with Merb
|
|
|
|
|
|
|
|
Merb 1.0 has built-in, seamless Webrat support. Just start using
|
|
|
|
methods from Webrat::Session in your specs.
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 00:59:27 +00:00
|
|
|
== Authors
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 00:59:27 +00:00
|
|
|
- Maintained by {Bryan Helmkamp}[mailto:bryan@brynary.com]
|
|
|
|
- Original code written by {Seth Fitzsimmons}[mailto:seth@mojodna.net]
|
2008-11-25 04:30:10 +00:00
|
|
|
- Initial development was sponsored by EastMedia[http://www.eastmedia.com]
|
2008-04-28 08:37:10 +00:00
|
|
|
- Many other contributors. See attributions in History.txt
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 00:59:27 +00:00
|
|
|
== License
|
2008-03-02 20:14:52 +00:00
|
|
|
|
2008-11-25 04:30:10 +00:00
|
|
|
Copyright (c) 2007-2008 Bryan Helmkamp, Seth Fitzsimmons.
|
|
|
|
See MIT-LICENSE.txt in this directory.
|