Archives de catégorie : continuous integration

Run UI tests on a headless Jenkins / Hudson Continuous Integration server running Ubuntu

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

In your job that launches UI tests (in my case it was Eclipse Equinox UI tests launched by a tycho build), tick the box « Run xvnc during build »
Now launch your job, you will run into this problem :

etc… until vncserver :13
It is because you need to launch vncserver interactively, at least once, to setup a password; connect to your ubuntu box and:

Once this is done, re launch your job :

and your build goes on, able to create a UI during the tests !

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.

To do so, you first have to know what is the port xvnc is listening to :

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 :