In case you didn’t notice the sidebar links, Henry Liu and I are wrapping up a JRuby Cookbook for O’Reilly and it’s up on Amazon for pre-order
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.
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:
This has to be done as the same user Hudson runs as.
As a follow-up to my post about using the FlexUnit results produced by the flex-mojos Maven plugin to produce a unit test report, I wanted to point out that this same technique can be used within the Hudson continuous integration server.
Here’s what the config looks like:
(Note that we’re also using Hudson’s JavaDoc support to publish the produced ASDoc).
This gives you all the nice Hudson unit testing support like graphs of tests per build:
UPDATE – With the Flex Mojos 1.0 release, the output directory for FlexUnit tests has changed. It’s now
surefire-reports, so the Test report XMLs value should be