Thursday, September 24, 2009

Fitnesse and Selenium as Services

Because I am working with Fitnesse and Selenium, I wanted a way to be able to remotely access tests on a central server, right now I am setting up the services on my own machine. These are the instructions I used to get things in place.

Set-up Fitnesse as a Service:
  • Install the Windows Resource Kit if its not already in place
  • Run the following command:
instsrv Fitnesse "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"
  • If the resource kit is not in that location update the path, but you MUST use the full path to srvany.exe or it will not work
  • Modify the Registry key in HKLM\SYSTEM\CurrentControlSet\Services\Fitnesse
  • Change the Image Path to point to Srvany.exe's full path (if not already done so)
  • Add a new key - Parameters HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Fitnesse\Parameters
  • and three string values,
    AppDirectory - AppDirectory is the root directory of our service where the Fitnesse bat file resides
    Application - is the java.exe executable needed to run our service
    AppParameters - is the parameters used by the java.exe to start our Fitnesse service.
  • In the Services panel verify that the Account being used to start the service has the right permissions
  • Start the service
  • To access the Fitnesse Web UI use the URL - http://local_ip_address:port/
Items to note:
  • If the Service starts, but does not open the port make sure Windows Firewall is set to allow access to the port.
  • If the Port is open but the open port is not appearing in a netstat -a then use the command line arguments to verify that the command line options work.
Example settings for Fitnesse Service:
AppDirectory - c:\fitnium
Application - C:\Program Files\Java\jre6\bin\java.exe
AppParameters - -cp fitnesse.jar;selenium-java-client-driver fitnesseMain.FitNesseMain -p 8888

Selenium Server:
  • In order to assure that Fitnesse can run its tests Selenium needs to be set up the same way
  • Modify the Registry key in HKLM\SYSTEM\CurrentControlSet\Services\Selenium
  • Change the Image Path to point to Srvany.exe's full path (if not already done so)
  • Add a new key - Parameters (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Service\Selenium\Parameters)
  • and three string values,
    AppDirectory - AppDirectory is the root directory of our service where the Selenium bat file resides
    Application - is the java.exe executable needed to run our service
    AppParameters - is the parameters used by the java.exe to start our Selenium service.
  • In the Services panel verify that the Account being used to start the service has the right permissions
  • Start the service
Example settings for Selenium Service:
AppDirectory - c:\fitnium
Application - C:\Program Files\Java\jre6\bin\java.exe
AppParameters - -jar .\selenium-server-1.0\selenium-server.jar   

No comments: