Watirloo

DESCRIPTION:

Custom Extensions for Watir, Firewatir. Acceptance Test Helper based on semantic page objects modeling customer’s domain language It helps you write human readable and machine executable browser tests. Isolates GUI from Tests.

The Human Readable part helps you create interfaces to elements on the page and tags them with friendly names based on vocabulary of Business Domain. The Machine Executable parts talk to Watir API hooking into DOM elements. it helps you concentrate in your acceptance tests on the intention and the customer’s language and not on implementation of DOM. Write customer facing tests hence the metaphor of face for Page Objects of Significance to the Customer.

FEATURES/PROBLEMS:

  • Extensions to Watir and Firewatir gems to ease testing and joy with page objects

  • group radios in #radio_group and checkboxes in #checkbox_group and acts each group as page object

  • Maintains multiple browsers on the desktop and stores window handles so you can reattach to the browser under test later (see Watirloo::Locker)

  • Watches and maintains your desktop for browsers existence. (Watirloo::Desktop)

  • Browser is managed automatically with Watirloo::browser

  • Isolates GUI from tests with face methods that introduce customer facing friendly names for elements

  • add reflect method to generate scaffolding code for your page elements (reflect currently uses browser as container. Alter scaffodling if you use frames)

  • look at spec dir for examples of usage with rspec

SYNOPSIS:

By convention Watirloo::browser attaches itself to the existing IE browser instance on the desktop and maintains the handles to reattach later

Example:

Given a page with text fields for last name and first name
When I want to enter the name 'Kurt Vonnegut'
And I don't want to talk to implementation
But I want a friendly name of element on the page
Then I use Watirloo shortcuts
When I define an interface to watir implementation with a semantic key
And I define my data as hash with the same semantic key
Then I can automatically let watirloo enter my test data on a page

# rspec as client

describe "using watirloo page to isolate and bind gui view to data" do
  include Watirloo::Page
  face(:last_name) { text_field(:name, 'l_nm') }
  face(:first_name) { text_field(:name, 'f_nm') }

  it "enters data on the page" do
    first_name.set "Kurt"
    last_name.set "Vonnegut"
  end

  it "sprays data on elements defined" do
    spray :last_name => 'Vonnegut', :first_name => 'Kurt'
  end

  it "grabs data from elements and validates" do
    data = {:first_name => "Kurt", :last_name => 'Vonnegut'}
    spray data
    scrape(data.keys).should == data
  end

end

REQUIREMENTS:

  • watir = 1.6.2

  • firewatir = 1.6.2 if you want to use Firefox

  • rspec gem if you want to run watirloo examples included

INSTALL:

  • Run the following if you haven’t already:

    gem sources -a http://gems.github.com
    
  • Install the gem(s): gem install marekj-watirloo

  • or download from : github.com/marekj/watirloo/downloads

ROADMAP

  • add Logging gem and log all actions for audit

  • provide UserStory type of container for exploratory testing (UseCase, Feature, TestScenario etc…)

  • provide examples for Cucumber

  • make specs run with firewatir

LICENSE

(The MIT License)

Copyright © 2008 marekj www.opensource.org/licenses/mit-license.php