# Really Quick Start

* Checkout the Project Wonder - the ERSelenium is in the Wonder/Common/Frameworks folder.
* Examine test cases from ERSeleniumExample/Resources/Selenium/main/ and from BugTracker in Eclipse text editor.
* Launch ERSeleniumExample and point your browser to SeleniumStartTesting Direct Action url (e.g. http://192.168.0.58/cgi-bin/WebObjects/ERSeleniumExample.woa/-42422/wa/SeleniumStartTesting).
You can also use Selenium IDE to create and edit tests:
* Launch FireFox and install Selenium IDE Firefox plugin.
* Using Selenium IDE format plugin installation instructions install Selenese-ide-plugin.js (it is in ERSelenium/Resources).
* Play around with test cases from ERSeleniumExample/Resources/Selenium/ using Selenium IDE.

# Overview and Usage Notes

ERSelenium provides several features for effective use of SeleniumCore with WebObjects applications including:
* 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).
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:
* Specify it as your project's workspace dependency .
* Enable it in the project's Properties file:
Debug output of ERSelenium can be enabled in Properties by:
Other ERSelenium properties:
* SeleniumTestsRoot="SomeOtherPath" - change the tests location. By default ERSelenium will search for tests in "Resources/Selenium".
* SeleniumActionsClass="FullClassName" - specifies the class with methods, which should be executed before and during the test using SeleniumAction direct action (see below for details). By default SeleniumDefaultSetupActions class is used.
* SeleniumReportPath="PathName" - specified the path to the report file, which is created after the testing is done. "./Contents/Resources/" is the default value.
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:
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":

# Some tips for writing tests for ERSelenium

* Don't use full URLs with open/openWindow commands (http://[baseurl] part will be added by ERSelenium):
* You can use setup/teardown methods from the class, specified in SeleniumActionsClass property by opening /wa/SeleniumAction/methodName URL, e.g.:
* You can use @repeat-@values-@done metacommands to execute specific part of the test with different values edited in textboxes, e.g.:
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.
* Selenium IDE Firefox plugin and XPath Checker 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.