1.4. Selenium RC (Remote-Control / Server) with Eclipse

Selenium IDE is the tool for recording and playing back directly in the browser, while Selenium RC (Remote-Control) is for testing remotely on the one hand and automated browser-launch on the other hand.

Install Selenium RC

Download Selenium RC here

But note: Version 1.0 beta 1 does NOT work with Firefox 3 - therefore download the nightly version or ask the developers for the right version since nightly is very unstable at times

Start Selenium RC as follows:

  • Open a command shell

  • Change into selenium-remote-control../selenium-server-.. directory

  • Make sure you have formerly compiled the user-extensions.js file

  • Then start Selenium RC with this command:

    java -cp ./selenium-server.jar org.openqa.selenium.server.SeleniumServer -userExtensions \eclipse\workspace\seleniumtests\build\classes\user-extensions.js
    	  				

    And you are ready to go!

Run a Selenium test from Eclipse

Use the tutorial examples in $CVS/olat3ext/tests/seleniumtests/src/org/olat/test/tutorial as starting points.

The main idea is to have your JUnit test class extend BaseSeleneseTestCase and call the two main features:

  • connect(seleniumHostname, browserId, baseTestUrl);

  • olatLogin(seleniumInstance, baseTestUrl, username, password, language);

Modifying test for nightly

After a test was successfully made run locally, it needs some tweaking to run nightly as well

First of all, the selenium host is no longer localhost but idmels04.uzh.ch instead. (at least for the moment)

Second, the baseTestUrl might have to be adjusted, e.g. test against nightly.uzh.ch

Finally any other setup which was dependent on having an olat instance or cluster running locally or anywhere else needs to be migrated to nightly - that would include using the Setup Framework as described later in this document