Running Unit Tests in Development

Running Regression Tests

Checkout the unit tests from the Watir trunk at www.github.com .
Details at this web page: http://wiki.openqa.org/display/WTR/Building+Watir

For firewatir, run these unit tests: firewatir/unittests/mozilla_all_tests.rb

For watir, run these unit tests: watir/unittests/core_tests.rb
You may need to do "gem install user-choices" first.

Testing Options

New, configurable features have been added to the Watir test suites. These can be enabled using an options.yml in the unittests directory. These procedures work equally for both the Watir and FireWatir unit tests.

In watir/unittests (and firewatir/unittests) there is a file named "options.yml.example". Remove the extension '.example'.

Several options can be set in this file. They will affect all tests executed from the directory (whether singly or as a suite)

Browser

You can specify which browser will be used.

browser: ie
browser: firefox

This functionality is now part of Watir itself and is described in more detail at Browser.new

Coverage

coverage: regression

By default tests will be run as "regression" which means that tests that are tagged as failing will not be run. Tests can be tagged as "fails_on_ie" or "fails_on"firefox".

coverage: known failures

This is the opposite of "regression". Only tests that are flagged as failing will be run. This is useful for compatibility testing.

coverage: all

All tests will be run. This is what used to happen before tagging was added.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Mar 03, 2009

    Fritz Anderson says:

    Is there a way to validate FireWatir on Darwin/Firefox? We've developed a patch...

    Is there a way to validate FireWatir on Darwin/Firefox?

    We've developed a patch for firefox.rb, and are at the point where we must write validation tests for it. I can't get the existing tests to run correctly against the unmodified check-out.

    When I run the firewatir mozilla_all_tests.rb script, I get 202 errors (no failures), mostly of the form "getWindows()[-1] is undefined." options.yml is in-place and contains "browser: firefox".

    Also, the tests attempt to open three instances of Firefox. Firefox/Mac OS X permits only one.

    Mac OS X 10.5.6, Firefox 3.0.6, FireWatir rev 1681 from the svn trunk, Ruby 1.8.6.

    I'm sorry if this is not the place for this; the openqa forums would not permit a discussion at what appeared to be the proper places.

  2. Mar 03, 2009

    Al says:

    Please go to Github to get the source code and unit tests now. Thanks,

    Please go to Github to get the source code and unit tests now.

    Thanks,

  3. Mar 03, 2009

    Fritz Anderson says:

    Thank you. On Mac OS X, there remains one error, in attach_to_existing_window_t...

    Thank you.

    On Mac OS X, there remains one error, in attach_to_existing_window_test.rb:40:in `test_existing_window', where "multiple browsers not supported on os x" is raised. Patch (abandoning test_existing_window if opening multiple instances raises a RuntimeError) forthcoming.