Coder Social home page Coder Social logo

foeken / webrat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from brynary/webrat

1.0 3.0 1.0 186 KB

Webrat - Ruby Acceptance Testing for Web applications

Home Page: http://www.brynary.com/uploads/webrat/rdoc/index.html

License: MIT License

Ruby 100.00%

webrat's Introduction

= Webrat

- [Code on GitHub](http://github.com/brynary/webrat)
- [Tickets on Lighthouse](http://webrat.lighthouseapp.com/)

== Description

Webrat (_Ruby Acceptance Testing for Web applications_)
lets you quickly write robust and thorough acceptance tests for a Ruby
web application. By leveraging the DOM, it can run tests similarly to an
in-browser testing solution without the associated performance hit (and
browser dependency). The result is tests that are less fragile and more
effective at verifying that the app will respond properly to users.

When comparing Webrat with an in-browser testing solution like Watir or
Selenium, the primary consideration should be how much JavaScript the
application uses. In-browser testing is currently the only way to test JS, and
that may make it a requirement for your project. If JavaScript is not central
to your application, Webrat is a simpler, effective solution that will let you
run your tests much faster and more frequently.

Initial development was sponsored by [EastMedia](http://www.eastmedia.com).

== Synopsis

    def test_sign_up
      visits "/"
      clicks_link "Sign up"
      fills_in "Email", :with => "[email protected]"
      selects "Free account"
      clicks_button "Register"
      ...
    end
  
Behind the scenes, this will perform the following work:

1. Verify that loading the home page is successful
2. Verify that a "Sign up" link exists on the home page
3. Verify that loading the URL pointed to by the "Sign up" link leads to a
   successful page
4. Verify that there is an "Email" input field on the Sign Up page
5. Verify that there is an select field on the Sign Up page with an option for
   "Free account"
6. Verify that there is a "Register" submit button on the page
7. Verify that submitting the Sign Up form with the values "[email protected]"
   and "Free account" leads to a successful page

Take special note of the things _not_ specified in that test, that might cause
tests to break unnecessarily as your application evolves:

- The input field IDs or names (e.g. "user_email" or "user[email]"), which
  could change if you rename a model
- The ID of the form element (Webrat can do a good job of guessing, even if
  there are multiple forms on the page.)
- The URLs of links followed
- The URL the form submission should be sent to, which could change if you
  adjust your routes or controllers
- The HTTP method for the login request

A test written with Webrat can handle these changes to these without any modifications.

== Install

To install the latest release:

    sudo gem install webrat

In your stories/helper.rb:
  
    require "webrat"
  
You could also unpack the gem into vendor/plugins.

== Requirements

- Rails >= 1.2.6
- Hpricot >= 0.6
- Rails integration tests in Test::Unit _or_
- RSpec stories (using an RSpec version >= revision 2997)

== Authors

- Maintained by [Bryan Helmkamp](mailto:[email protected])
- Original code written by [Seth Fitzsimmons](mailto:[email protected])
- Many other contributors. See attributions in History.txt

== License

Copyright (c) 2007 Bryan Helmkamp, Seth Fitzsimmons.
See MIT-LICENSE.txt in this directory.

webrat's People

Contributors

brynary avatar lukemelia avatar dbussink avatar kamal avatar pd avatar foeken avatar bakineggs avatar quirkey avatar joevandyk avatar nicksieger avatar timcharper avatar

Stargazers

Angus H. avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.