is an extension of my much more indepth first posting on how to unit
Recap Last Posting
Problem with typical CI environments
What we need to do is to run JSTestDriver's browser in a Virtual X Framebuffer (Xvfb) which is possible on nearly all Linux based systems. The example below uses a Solaris version of Linux, however, Debian and RedHat linux distrubutions come with the simplified bash script to easily run an appliation in a virtual framebuffer. This solution was derived from one posted solution on the JS Test Driver wiki (http://code.google.com/p/js-test-driver/wiki/ContinuousBuild. The given example is also a full working example that is in use at my current client.
Here is the quick list of what we will accomplish. Note, several of these steps are discussed in depth in the previous post and are not covered in depth here.
- Create a profile to run Js Unit-Tests
- Copy JsTestDriver library to a known location for Maven to use
- Use ANT to start JsTestDriver and pipe the screen into xvfb
Here is a sample profile to use. You will need to adjust the properties at the top of the profile to match your system.
Although I cannot predict or fix all problems, I can share the one major problem I ran into with Solaris and the script used to fix that. In Solaris (and could happen to other distros) the xvfb-run script was not available and several of the other libraries did not exist. I first had to download the latest X libraries and place them in their appropriate locations on the CI server. Next, I had to re-engineer the xvfb-run script. Here is a copy of my script (NOTE: This is the solution for my server and this may not work for you)
I created a script that contains:
/usr/openwin/bin/Xvfb :1 screen 0 1280x1024x8 pixdepths 8 24 fbdir /tmp/.X11-vbf &
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)