CDash:Testing/Selenium
Selenium is a testing tool for web applications. It reads in a script and uses it to drive a web browser. This allows us to test functionality in CDash (such as javascript) that we can't test with PHP alone.
Download Software
Download "Selenium RC" from SeleniumHQ. Unpack the .zip file once it's done downloading.
Selenium is based on java. If you don't already have java installed, download it here: Java downloads.
The Selenium tests in CDash uses PHPUnit under the hood. Download phpunit from their homepage or your favorite package manager.
Run the Selenium Remote Control Server
All of the Selenium-based tests in CDash will fail if the Selenium RC server isn't running. Fortunately, this is pretty easy to do:
cd /path/to/selenium/selenium-server-1.0.3 java -jar selenium-server.jar
See CDash:Testing/Nightly for information about automatically starting & stopping the Selenium server from a nightly build.
Write New Tests
If you'd like to write new Selenium-based tests for CDash, you'll need to download the Selenium IDE from SeleniumHQ. This is a plugin for the Firefox web browser. Writing new tests is generally pretty easy.
- In Firefox, select Tools -> Selenium IDE
- This will automatically create a new test case and start recording. Just interact with your web browser as you normally would to record the behavior that you'd like to test.
- When you're done, click the red circular record button to stop the test.
- Select File -> Export test case -> PHP. You should also save the test as .html in case you need to edit it at a later date.
- You'll have to edit the resulting .php file to remove hardcoded paths and host names. Take a look at the other .php files in CDash/testing/selenium for an example of how to do this.