I really like the looks of PHPUnit working with Selenium RC, but my main complaint about it at this point is that I’m running the proxy server on my local machine, rather than a remote machine. I think I’ll be able to run it on a remote machine without a problem, but to view the test in progress, I believe I’ll need VNC or No Machine’s FreeNX to connect to an X server. That is something I’ve wanted to setup anyway, so I’ll get to it. I’ve got the perfect machine to set this up on: an Everex NC1503 running linux!

Actually, I’m ending up using the $350 laptop I purchased from Fry’s awhile back, it’s less energy efficient than the Everex, but it will only be on while I’m conducting tests. For this to work, I’m setting up a VNC server on the laptop. Its already running Ubuntu, and I’m following these instructions:

HOWTO: Set up VNC server with resumable sessions

Actually that howto is really old, this one is better for Ubuntu 7: HOWTO: Set up VNC server with resumable sessions

The laptop is currently updating a bunch of stuff, so I’m waiting for that to finish before installing VNC.

Got VNC up and running, now I’m upgrading Java (Selenium RC requires Java 1.5 or greater).

java -version
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)

All set!

I’ve run into this issue several times: when I try and start a new browser session, I get “Preparing Firefox profile…” then it hangs there. This has happened on Mac OS X and Ubuntu. Hmmmm, maybe this is caused by a firefox that crashed? Nope, I guess that’s caused by a Firefox 2.0 thing, so I’m going to use the latest version of Selenium RC.

Now I’m installing PHP5, PEAR, and Apache2, as well as phpunit through pear. Done, that was easy!

So, while I have testing environments set up for various application servers, this will be our first testing client machine. :-)

Benefits of driving Selenium RC with PHPUnit

As far as I can tell, the benefit for me to use PHPUnit with Selenium is that PHPUnit can output reports of the test results.

In addition to that, we can also build tests automatically, which is pretty sweet.

I also just figured out how to set a test to use a remote selenium RC server:

void setHost(string $host)	

“Set the hostname for the connection to the Selenium RC server.”

Related Links

Getting Selenium RC and PHPUnit to work together was a little vague, but I found these links helpful:

sebastian-bergmann.de/…Integrating-PHPUnit-with-Selenium

devzone.zend.com/…Acceptance-Testing-of-Web-Applications-with-PHP

phpunit.de/…selenium.html

openqa.org/selenium-rc/tutorial.html