This blog has moved, permanently, to http://software.safish.com.

Friday, September 18, 2009

Running Selenium RC as a Windows Service

We've recently started using Selenium as a testing tool at work. The IDE is great, particularly for filling in forms during development, but I'm a stickler for automated testing.

Selenium does off Selenium RC, which combined with nUnit allows for this in a variety of programming languages. The problem here, is that the server is a jar file, and I wanted it running as a windows service on our build server.

Anyway, I found a great article on tacktech.com that shows how to run just about anything as a windows service - and I successfully used that article to get Selenium RC running as windows service on our build server. Here are the steps:
  1. Install the latest Java runtime if you don't have it installed already
  2. Install the Selenium server (e.g. C:\Selenium\selenium-server-1.0.1
  3. Download srvany.exe and instsrv.exe (these are part of the Microsoft Windows Resource Kit - you will need to download the correct version for your OS) and copy these files to a location on your server (e.g. C:\reskit)
  4. Browse to this folder, and type: instsrv "Selenium RC" "C:\reskit\srvany.exe" - this will create the windows service named "Selenium RC", which will now be installed as a Windows service, although it won't start up yet
  5. Open up regedit, and browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Selenium RC
  6. Right-click "Selenium RC" in the tree, and click New - Key, and add a key called "Parameters"
  7. Open Parameters, and create a new string value called "Application"
  8. Add the following to the data value for the new string value: "C:\Program Files (x86)\Java\jre6\bin\java.exe" -jar "C:\Selenium\selenium-server-1.0.1\selenium-server.jar", substituting paths to the java exe and the selenium server jar file where appropriate
  9. Load up the windows services console (services.msc) and start the service

3 comments:

  1. I've followed those steps. The service seems to be running but, when I trigger one of my Selenium tests from my Test Hub application the page just keeps saying Loading.

    If I stop it it throws an error so it seems like it is running but it doesnt seem to do anything.

    I've also tried running it via the command line using the same command in the Application parameter and it works this way.

    Do you have any ideas?

    ReplyDelete

Note: Only a member of this blog may post a comment.