Run UI SeleniumRC tests as a part of CI process Run UI SeleniumRC tests as a part of CI process selenium selenium

Run UI SeleniumRC tests as a part of CI process


In our organization we have a continuous integration server (Cruise Control) running the build including Selenium RC tests. The CI server is run as a Windows service (on MS Windows 2003 Server) and Selenium tests are just part of the test suite.

That is quite a straightforward setup and frankly I see no reasons for giving up with it. Currently in our setup the Selenium server (and client) is started directly from the tests (however we used to have Selenium as a separate service).

In Java code (actually in the super class of all web tests) we do something like:

// to start the serverRemoteControlConfiguration config = new RemoteControlConfiguration();config.set(...)  // set the serverHost and port...SeleniumServer server = new SeleniumServer(config);server.start();// and then to start the clientSelenium selenium = new DefaultSelenium(serverHost, port, "*firefox", "http://www.google.com");selenium.start();selenium.open("http://www.google.com");// now the browser should be visible for you (if you run it locally, not as a service)

So I would suggest you trying the following (whatever language you are using):

  1. Try to run the Selenium server and client from just a standalone application. The browser should show up as a window. Adjust the settings to your needs (browser type, etc.).

  2. Try to incorporate the code within your test framework (xUnit or whatever). Run them manually. The result should be the same.

  3. Then you can try to have the tests run from the continuous-integration. Run the CI server as a service and let it build your project. The browser wouldn't be visible, but that's not required for the tests to be run, isn't it?

NOTE:if you wanted to peep what Selenium is doing, I believe it would be easier on UNIX machine. You could point the tests to use the X-server DISPLAY of your choice - a fake one or a true one connected to some monitor.


I'm skeptical about running anything as a windows service that is supposed to interact with a desktop application. Windows services run in their own sandbox; they're not supposed to interact with a user's desktop or its applications. To do so requires special efforts to communicate with the service, so if it is possible at all, I would think there would be some kind of desktop client running as well, acting as a liaison between the browser and the windows service.

I can't tell you it won't work, though, because it is obviously possible if people are blogging about it.

Why does it need to run as a Windows service, by the way? Is that how Selenium has set up their automation, or can you do it without the Windows service? Because I think that would be the shortest distance between two points.


My recommendation would be to have a dedicated machine (or virtual machine) for running Selenium RC. In my experience it's best to let Selenium run interactively rather than in a headless mode.