Child pages
  • ERSelenium Framework

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor formatting updates

...

...

  • Custom setup/teardown actions that can be run before/after each test.
  • Base URL independence.
  • Support of HTML and Selenese test formats (Java support is planned).
  • "On-the-fly" generation of test suites from the files in your project's source tree.
  • Bookmarkable DirectAction url to run all tests (can be used for automated testing).
  • Metacommands (special instructions specified in comments). Panel

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:
    Code Block
    SeleniumTestsEnabled=true
    
    Panel
    Debug output of ERSelenium can be enabled in Properties by:
    Code Block
    log4j.logger.er.selenium = DEBUG
    

...

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:

Code Block
./Resources
{panel}   ./Selenium
    ./registration
      ./successful.sel
      ./alreadyexists.sel
    ./shop
      ./buyitem.html
      ./notenoughmoney.html
      ./transfer.sel
{panel}

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":

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

...

  • Don't use full URLs with open/openWindow commands (http://baseurl part will be added by ERSelenium):
    Code Block
    {panel}   |open|/wa/EditPerson|
      |open|/|
    {panel}
    
  • You can use setup/teardown methods from the class, specified in SeleniumActionsClass property by opening /wa/SeleniumAction/methodName URL, e.g.:
    Code Block
    {panel}   |open|/wa/SeleniumAction/resetSession|
    {panel}
    
  • You can use @repeat-@values-@done metacommands to execute specific part of the test with different values edited in textboxes, e.g.:
    Code Block
    {panel}   |open|/|
      @repeat
      ...some actions...
      @values __selenium_test@ @__sel notcorrect@@
      |type|xpath=id('content')/input|__selenium_test@incorrectdomain|
      ...some actions...
      @done
    {panel}
    
    The commands between @repeat and @done will be repeated several times, each time with new value in "xpath=id('content')/input" input field. Panel

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.

  • Selenium IDE Firefox plugin and [ XPath Checker|https://addons.mozilla.org/ru/firefox/addon/1095] can be very handy for creating and editing Selenium tests. Selenium IDE Selenese source plugin with proper comments support resides in ERSelenium/Resources/selenese-ide-plugin.js.

Category:WebObjects