Bryan Helmkamp
2007-Nov-30 02:25 UTC
[ANN] Webrat 0.1.0 released - Ruby Acceptance Testing for Web applications
Webrat - Ruby Acceptance Testing for Web applications - version 0.1.0 released! <http://svn.eastmedia.net/public/plugins/webrat/> Webrat 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. Webrat works with vanilla Rails integration tests run via Test::Unit and scenarios run by the RSpec story runner. == SYNOPSIS: def test_sign_up visits "/" clicks_link "Sign up" fills_in "Email", :with => "good-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" select "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 "good-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" 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 all of these changes smoothly. == INSTALL: $ ruby script/plugin install http://svn.eastmedia.net/public/plugins/webrat/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jeremy McAnally
2007-Nov-30 04:47 UTC
Re: [ANN] Webrat 0.1.0 released - Ruby Acceptance Testing for Web applications
This looks awesome. Hopefully this will help reduce the number of times I want to punch *Watir in the face. --Jeremy On Nov 29, 2007 9:25 PM, Bryan Helmkamp <brynarylists-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Webrat - Ruby Acceptance Testing for Web applications - version 0.1.0 > released! > > <http://svn.eastmedia.net/public/plugins/webrat/> > > Webrat 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. > > Webrat works with vanilla Rails integration tests run via Test::Unit > and scenarios > run by the RSpec story runner. > > == SYNOPSIS: > > def test_sign_up > visits "/" > clicks_link "Sign up" > fills_in "Email", :with => "good-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" > select "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 > "good-hcDgGtZH8xNBDgjK7y7TUQ@public.gmane.org" > 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 all of these changes smoothly. > > == INSTALL: > > $ ruby script/plugin install http://svn.eastmedia.net/public/plugins/webrat/ > > >-- http://www.jeremymcanally.com/ My books: Ruby in Practice http://www.manning.com/mcanally/ My free Ruby e-book http://www.humblelittlerubybook.com/ My blogs: http://www.mrneighborly.com/ http://www.rubyinpractice.com/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---