WebObjects/Project WONDER/Frameworks/ERSelenium

< WebObjects < Project WONDER < Frameworks

Really Quick Start

You can also use Selenium IDE to create and edit tests:

Overview and Usage Notes

ERSelenium provides several features for effective use of SeleniumCore with WebObjects applications including:

SeleniumCore is the powerful javascript toolkit for web applications "black-box" testing. It emulates different kinds of user actions such as: clicking the hyperlink, editing text in the input field, choosing item from the list and so on.

Using ERSelenium

You can use ERSelenium directly from workspace:

  1. Specify it as your project's workspace dependency .
  2. Enable it in the project's Properties file:
SeleniumTestsEnabled=true

Debug output of ERSelenium can be enabled in Properties by:

log4j.logger.er.selenium = DEBUG

Other ERSelenium properties:

In your SeleniumTestsRoot folder (Resources/Selenium by default) you should create tests hierarchy. Tests are divided into groups, each group is located in its own folder. In each folder there should be a collection of test files, each in one of the formats, supported by ERSelenium. Example hierarchy:

./Resources
  ./Selenium
    ./registration
      ./successful.sel
      ./alreadyexists.sel
    ./shop
      ./buyitem.html
      ./notenoughmoney.html
      ./transfer.sel

You can use both standard HTML and wiki-like Selenese formats for writing tests although Selenese format is usually a preferred choice.

To run all tests point your browser to SeleniumStartTesting Direct Action: http://[baseurl]/wa/SeleniumStartTesting

Example: http://127.0.0.1/cgi-bin/WebObjects/SampleProject.woa/-42421/wa/SeleniumStartTesting

To run a specific group of tests, add "/TestGroupName":

http://[baseurl]/wa/SeleniumStartTesting/TestGroupName
http://127.0.0.1/cgi-bin/WebObjects/SampleProject.woa/-42421/wa/SeleniumStartTesting/registration

Some tips for writing tests for ERSelenium

  |open|/wa/EditPerson|
  |open|/|
  |open|/wa/SeleniumAction/resetSession|
  |open|/|
  @repeat
  ...some actions...
  @values __selenium_test@ @__sel notcorrect@@
  |type|xpath=id('content')/input|__selenium_test@incorrectdomain|
  ...some actions...
  @done

The commands between @repeat and @done will be repeated several times, each time with new value in "xpath=id('content')/input" input field.

Note: in Selenese format, lines that don't begin with "|" are treated as comments, so metacommands in the example above will be safely processed by Selenium IDE.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.