For Quality Assurance, it is important that the testing of functionality can be automated.

Depending on the detail of the tests, the tests are called Unit Tests or Integration tests.

This article shows how to write tests in Python, and run them against an installed instance of Kolab, using Selenium, on CentOS.

Useful links are:

We are using the Firefox browser on a headless CentOS machine.

We need to install the following packages:

sudo yum install python-setuptools Xvfb firefox 
sudo easy_install selenium 
sudo dbus-uuidgen > /var/lib/dbus/machine-id
 

To run Firefox on a headless system, you need to start the X Virtual FrameBuffer (Xvfb):

sudo Xvfb :10 -ac -screen 0 1280x1024x24

On another console, you can now run:

export DISPLAY=:10
python test.py

For a first example of a test for Kolab, see testCreateUserAndEditSelf.py. This test assumes that the password of the Directory Manager is "test", and it will create a new user, check that the default folders in the mailbox have been created, login with that user, and attempt to change the initials of the user and save them.

By the way, the test currently fails on Kolab 3.1 updates (check /var/log/httpd/error_log for details), due to bug https://issues.kolab.org/show_bug.cgi?id=2414, which was the whole point of setting up this test case…

Update:

Instead of Firefox, you can also use PhantomJS with Selenium to have a headless browser. It is based on Webkit.You need to download a binary once, from phantomjs.org/download.html:

wget https://phantomjs.googlecode.com/files/phantomjs-1.9.2-linux-x86_64.tar.bz2
tar xjf phantomjs-1.9.2-linux-x86_64.tar.bz
cp phantomjs-1.9.2-linux-x86_64/bin/phantomjs /usr/bin
Kolab Integration Tests with Selenium and Python
Tagged on: