Running Selenium PHPUnit tests against Firefox in an Ubuntu virtual machine

As part of my Hudson CI server, I'm trying to run Selenium-based PHPUnit tests with each build. The build machine is an virtual machine (VirtualBox) running Ubuntu desktop.

Initially, my tests weren't running thru Hudson and the associated build.xml file. This wasn't surprising since I had forgotten to start the Selenium RC server.

I started the server thru a Putty session from my Windows host into the VM. I thought the only important thing was to start Selenium RC listening on the right port (4444 default). But it looks like I need to start the server within a "uniform" environment.

In other words, I didn't have an X-Windows DISPLAY variable setup on my Putty SSH session when I started the Se RC server from there. So (I guess), Firefox couldn't be launched thru my Putty session.

I expected Firefox to run "within" the VM's desktop environment, but by starting the Se RC server on my DISPLAYless SSH terminal, the browser couldn't start up.

I fixed this by running Se server within a Terminal session on the **desktop** :

`$ java -jar selenium-server.jar -browserSessionReuse -forcedBrowserModeRestOfLine "*firefox /usr/bin/firefox" &`

Now things seem to work as expected. The Se RC server is running from within Terminal on the desktop, the browser is running on the desktop, and I can watch results from my Hudson by looking at the VM's desktop if desired.

Here are a couple links useful for this :