If you want to set up a ci build, running ui tests, on a box without any windowing system, you need to pay attention to a few details, here are some of them :
Set up your ubuntu box and Jenkins/Hudson
On your ubuntu box :
# apt-get install vnc4server fluxbox
Vnc4server is a free vnc server, that will act as your X environment, and fluxbox is a tiny window manager; more than enough for UI testing.
In Jenkins / Hudson, Manage Jenkins -> Plugins -> Install new plugins, choose the xvnc plugin
1 |
Starting xvnc [workspace] $ vncserver :10 You will require a password to access your desktops. getpassword error: Invalid argument Password:Starting xvnc [workspace] |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# su jenkins $ vncserver :10You will require a password to access your desktops. Password: Verify: Password too long - only the first 8 characters will be used xauth: creating new authority file /var/lib/jenkins/.Xauthority New 'host:10 (jenkins)' desktop is host:10 Creating default startup script /var/lib/jenkins/.vnc/xstartup Starting applications specified in /var/lib/jenkins/.vnc/xstartup Log file is /var/lib/jenkins/.vnc/host:10.log |
1 2 3 |
[workspace] $ vncserver :14 New 'host:14 (jenkins)' desktop is host:14 Starting applications specified in /var/lib/jenkins/.vnc/xstartup Log file is /var/lib/jenkins/.vnc/host:14.log |
Have a look at the tested UI while the tests are running
This can be very useful whenever your UI gets stuck (waiting on a dialog to be closed …, in my case I run into the issue of launching an eclipse runtime, and a plugin, Google ADT, was asking to confirm whether or not I wanted to upload usage data– hopefully only the first time) during the tests.
1 2 |
# ps aux |grep "vnc" jenkins 29591 0.0 0.7 33192 14104 ? S 21:10 0:00 Xvnc4 :14 -desktop host:14 (jenkins) -auth /var/lib/jenkins/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /var/lib/jenkins/.vnc/passwd -rfbport 5914 -pn -fp /usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/Speedo/,/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/75dpi/,/usr/X11R6/lib/X11/fonts/100dpi/,/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb |
OK, looks like xvnc is listening on port 5914 in this case.
You can then use a vnc viewer (on ubuntu, vinagre is a good choice) of your choice to connect to your ubuntu box on port 5914.
If the ubuntu box has firewall rules impeding you to connect to 5914, then set up a ssh tunnel :
$ ssh -L 5914:localhost:5914 anthony@ubuntubox
then connect your vnc viewer to localhost:5914 , and the magic begins !
A concrete example : m2eclipse-android-integration in Jenkins
I actually set up this configuration for the m2eclipse-android-integration project; this project is an eclipse plugin, that extends the capability of m2eclipse to android projects, here is the link to the Jenkins hosting this job
The author, Ricardo Gladwell, designed exclusively integration tests on the UI, since most of the functionality of this eclipse plugin is UI contribution.
Here are the specific problems I met while setting up this job in Jenkins :
- as I previously mentioned, the first time I launched the job against this project, once all the tests passed, the tycho surefire plugin step would not stop… actually the Google ADT plugin in Eclipse, was asking to confirm whether or not I wanted to upload usage data, so I connected to the UI and clicked « ok »; vnc saved the day…
- the tests were relying on android projects, requiring to have among the latest Android libraries; to be up to date (so that the tests would not fail), I had to run the command :
$ android update sdk --no-ui --obsolete --force
Overall, that was a good exercise to practice CI on a UI project.
Links :
And how we are supposed to do this on mac os server?
using docker or a Linux VM ?
more seriously, did you try using brew to install xvnc and xquartz ?