This articles explains how to setup integration testing of web applications (that require a browser instance) on a Jenkins server. The article assumes you are able to understand the title. If you need a reminder follow the links below.
|Automated browser testing (source: Jeremy Keith)|
What is Jenkins? Read here.
What is an X server? Read here.
If you are still puzzled, this article is not for you.
Integration testing of web application is more complicated than unit testing, because they require a browser instance to be running. In order to run a browser (such as Firefox) you need and X server. The testing server usually doesn't have one.
One solution to this is to run the browser instance on another machine through VNC. This has the advantage of not using the same resources as the testing server. However it requires setting up a new machine, and configuring the integration tests to run a browser in it.
Another solution is to use Xvfb, a display server that implements the X11 protocol, but does not require a screen to run. Instead all the operations are run in-memory. This allows Firefox to run without complaining, because it is tricked into believing it has a screen.
Step by step installation instructions:
1. Install Xvfb (and fonts)
apt-get install xvfb x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps
2. Install the xvfb-plugin for Jenkins from the Jenkins Admin dashboard.
3. The administrator also needs to configure Jenkins as shown here.
4. The rest can be done on a per Jenkins-project basis, without administrator rights. Simply follow the instructions here.