http://www.wocommunity.org/podcasts/WOWODCW09-TDD.mov - 1 hour plus session on Test Driven Development with WebObjects presented by Denis Frolov on WOWODC 09. Shows how to use ERSelenium, jUnit, and Mockito with WebObjects.
- Checkout the Project Wonder - the ERSelenium is in the Wonder/CommonFrameworks/Frameworks Misc folder.
- Examine test cases from Wonder/Examples/Misc/ERSeleniumExample/Resources/Selenium/main/ and from BugTracker in Eclipse text editor.
- Launch ERSeleniumExample and point your browser (preferably FireFox - there are known issues with Safari) to SeleniumStartTesting Direct Action url (e.g. http://192.168.0.58localhost/cgi-bin/WebObjects/ERSeleniumExample.woa/-42422/wa/SeleniumStartTesting).
You can also use Selenium IDE to create and edit tests:
- 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).
Adding the ERSelenium
framework dependency to an Application
You can add a ERSelenium test runner component framework dependency to your application with eclipseEclipse/WOLips:
- Add the ERSelenium.framework to your project's workspace Libraries dependency. See the tutorial: Add a Framework Dependency
- (Optionally. Disabled by default. Use with caution). Enable the framework in the project's Properties fileSelenium tests direct action url in production mode via the property:
Debug output of ERSelenium can be enabled in Properties by:
log4j.logger.er.selenium = DEBUG
To run all tests point your browser to SeleniumStartTesting Direct Action:
To run a specific group of tests, add "/TestGroupName":
- Don't use full URLs with open/openWindow commands (http://baseurl part will be added by ERSelenium):
- You can use setup/teardown methods. They should be implemented as direct actions in the separate class, which should be er.selenium.SeleniumAction-descendant. SeleniumAction class has some handy helper methods and automatically turns your selenium-related actions off when selenium is disabled in Properties. Here's the example of using selenium-related direct actions in the test (suppose that resetSessionAction() is defined in the class "Selenium"):
- You can use @repeat-@values-@done metacommands to execute specific part of the test with additional values edited in textboxes, e.g.:
The commands between @repeat and @done will be repeated several times, each time with new value in "user" and "password" input field. The values are seperated by spaces and if you have multiple @values lines, they all must have the same number of parameters. The @values section applies to the value of the next command.
@repeat ...some actions... @values user1 user2 user3 |type|user|user0| @values pass1 pass2 pass3 |type|password|pass0| ...some more actions... @done