webrat/README.rdoc

85 lines
2.4 KiB
Plaintext
Raw Normal View History

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
- http://groups.google.com/group/webrat
- http://webrat.lighthouseapp.com/
- http://github.com/brynary/webrat
2008-11-25 19:07:42 +00:00
- #webrat on Freenode
2008-11-25 00:59:27 +00:00
== Description
2008-03-02 20:14:52 +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
== Features
2008-03-02 20:14:52 +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
2008-12-03 00:57:10 +00:00
Webrat::Selenium 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.
== Example
2008-03-02 20:14:52 +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"
end
2008-11-25 00:59:27 +00:00
end
Behind the scenes, Webrat will ensure:
* 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-30 20:54:22 +00:00
== Installing Nokogiri
Users of Debian Linux (e.g. Ubuntu) need to run:
sudo apt-get install libxslt1-dev libxml2-dev.
Otherwise the Nokogiri gem, which Webrat depends on, won't install properly.
== Install for Rails
2008-03-02 20:14:52 +00:00
To install the latest release as a gem:
2008-03-02 20:14:52 +00:00
sudo gem install webrat
2008-04-04 14:44:50 +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
2008-12-27 23:22:51 +00:00
In your test_helper.rb or env.rb (for Cucumber) add:
2008-12-09 05:19:44 +00:00
require "webrat"
2008-12-27 23:22:51 +00:00
2008-12-09 05:19:44 +00:00
Webrat.configure do |config|
2008-12-27 23:22:51 +00:00
config.mode = :rails
2008-12-09 05:19:44 +00:00
end
2008-04-04 14:44:50 +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]
- Initial development was sponsored by EastMedia[http://www.eastmedia.com]
- 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
Copyright (c) 2007-2008 Bryan Helmkamp, Seth Fitzsimmons.
See MIT-LICENSE.txt in this directory.