Cheesy Title

June 4th, 2008 by justin

Using Xvnc within Hudson to run FlexUnit tests

Like most people unit testing Flex applications with FlexUnit in a Continuous Integration environment, I’ve based our setup on Peter Martin’s blog post from January 2007. In it, he describes one of the core challenges of this type of configuration: the fact that the CI server is likely headless. Martin’s solution is to use Xvfb. And this works fine.

But Hudson can do better because someone (Kohsuke, I assume) wrote a plugin for Xvnc. Simply install the plugin and check the checkbox in the job configuration screen:

Hudson will then automatically start up a Xvnc session and set the DISPLAY environment variable to the appropriate value and then shut down the session when the build is complete. One advantage this has over the Xvfb method is that if you have multiple Flex projects building simultaneously, each build has its own X session. While this has yet to be an issue for our projects, it seems like a good idea. The architecture of FlexUnit actually makes simultaneous builds a bit tricky. In another post, I’ll cover how Hudson can solve this problem too.

A word of warning:
Before using this plugin, you obviously have to have Xvnc installed. What’s less obvious (although sensible) is that you must also set a password. You do this by running:
$ vncpassword
This has to be done as the same user Hudson runs as.

  • Hello,

    I'm trying to get the XVNC plugin working in conjunction with my maven flex-mojo build so I can do flexunit testing, but I've run into a snag. My vnc server starts correctly at the begining of the build, but when it's time for the flexunit tester to connect, the build just hangs. I have a theory though . . .

    I'm using tightvnc on ubuntu 8.04 running hudson through tomcat5.5. In order to start the vncserver I had to create a password that is stored at /usr/share/tomcat55/.vnc/passwd. While the hudson build is running, I can connect to the vnc server using a different VNC Client, but only if I use the password I have set.

    Is there a way to to specify a password for hudson to use when connecting to the vnc session during the build?

    Thanks in advance, I can post log files and other info if that helps.

  • justinedelson

    I can't speak for the Xfvb way. But with the Xvnc plugin, you can use VNC to log into the host. We had an issue where the unit tests caused an error that wasn't caught. The Flash Player popped up a stack trace and just hung out there.

    I've been trying to add some functionality to the Xvnc plugin that would have it take a screenshot after the build. With a combination of this and the build-timeout plugin, we were able to identify this type of problem.

  • peter

    I haven't been able to get either method to work. I install and start Xvfb and set the DISPLAY env var, but when the task gets to the point of launching the swf in the flash player, the build hangs, with no error output. Same thing happens with the Xvnc plugin.. I have no idea if or whether the Linux flash player puts log files anywhere & there doesn't seem to be documentation on that.. any ideas??

blog comments powered by Disqus