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:
- Install the latest Java runtime if you don’t have it installed already
- Install the Selenium server (e.g. C:\Seleniumselenium-server-1.0.1
- 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)
- 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
- Open up regedit, and browse to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControl\SetServices\Selenium RC
- Right-click “Selenium RC” in the tree, and click New - Key, and add a key called “Parameters”
- Open Parameters, and create a new string value called “Application”
- Add the following to the data value for the new string value: “C:\Program Files (x86)\Java\jre6\bin\java.exe” -jar “C:\Seleniumselenium-server-1.0.1\selenium-server.jar”, substituting paths to the java exe and the selenium server jar file where appropriate
- Load up the windows services console (services.msc) and start the service