Now that we have created some simple cucumber tests and built a sturdy selenium framework, we want to setup an environment where these tests can be quickly and conveniently run against our code. Due to the nature of development, code is constantly changing, and we want to ensure that each change to the code doesn’t break the functionality we expect. To accomplish this we’re going to implement a Continuous Integration (CI) solution. Each time code is changed and checked in, we will execute our tests, analyze the results, and notify users if appropriate. A later post will discuss additional analysis tools to incorporate into our CI solution.


Coveros offers a free CI stack called SecureCI. The Linux based version of this stack is built on Ubuntu Server, and has combined many open source tools into a fully integrated continuous integration suite. This post will focus on employing Hudson as a polling server over a subversion repository for our application code. As mentioned above, a further post will explore additional tools bundled with SecureCI to perform static analysis, coverage, security testing and more.



In order to run this version of SecureCI, you’ll VMWare’s free player. Download VMware Player from:
Click on the download link for “VMware Player for Windows 32-bit and 64-bit”. Run the installer executable and follow the instructions.
Once SecureCI is downloaded and unzipped, launch it with VMWare player. On the first login to the application, you will need to create a user and password. On launch, note the application IP. This will be referred to multiple times throughout these steps being referenced as [VM INTERNAL IP]

Download Application Code

The application code, along with the code for running the test suite can be found on GitHub. Download the application (and the tests if not already present from following the previous posts) to your home folder within SecureCI using the below commands.

	cd ~


First we need to check our code into Subversion. SecureCI has Subversion installed and available via the network. Still within the SecureCI VM; run the below command to perform the initial commit to Subversion.

svn import https://[VM INTERNAL IP]/svn/secureci/CosmicComix -m "Adding initial import"

Deploy Code

Lastly we need to deploy the application code. To have this code up and running in apache, follow two simple steps. Navigate to the apache home folder.

cd /var/www

Check out the code from subversion.

sudo svn co https://[VM INTERNAL IP]/svn/secureci/CosmicComix/app

Running on SecureCI

Application and Test Setup

Once we have the code checked into subversion, and manually deployed, we want to try running it locally. First we want to ensure the application is properly running. With SecureCI still running, navigate to the below link to check that the application loads:

https://[VM INTERNAL IP]/app/

Next we will need to go back into the code we wrote previously, and modify the application URL. Open the file ‘’ and modify the appURL String we had previously set.

	//the url of our application
	private final String 		appURL = "http://localhost/app";	//Our locally hosted application

Once that is complete, we’ll want to run our tests from the command line. Previously we had run as a developer, from Eclipse, and now we’ll see the other side. Compiling our test code, and executing it locally.

Setting Up Hudson

The Hudson plots plugin provides generic plotting capabilities in Hudson. We’ll use this to track our success rate over time, and see how our current test results compare to our previous test results. Install the plugin by following the below steps.

  • Navigate to Hudson: https://[VM INTERNAL IP]/hudson
  • Click on Manage Hudson in the upper left section
  • Click on Manage Plugins in central menu
  • Click on the Available tab
  • Select the Plot Plugin, and click the Install button at the bottom of the screen
  • Then click the Restart When No Jobs Are Running button

Additional Applications

We’ll want to install a few additional applications on SecureCI. SecureCI does not come pre-packaged with Ant, so first we’ll install it using aptitude.

sudo apt-get –y install ant

Next we’ll want to install Firefox. When running locally, we saw that the tests all ran by opening up our Firefox browser. SecureCI also does not come pre-packaged with any browsers; so again, we’ll install Firefox using aptitude.

sudo apt-get –y install firefox

Finally, we’ll need to port our Firefox out to some display so that selenium can properly access the screen. As SecureCI runs in a headless environment, we’ll setup a virtual frame buffer: a virtual screen. Install Xvfb with the below command.

sudo apt-get –y install xvfb


SecureCI currently has Hudson installed running under Tomcat, and run as root. In order to properly execute all of the commands we’ll want to in Hudson, we first will need to change some permissions.
We need to give additional users rights to the Tomcat and Hudson libraries, along with java. This is done very simply with the below three commands.

	sudo chmod –R 777 /var/lib/tomcat
	sudo chmod –R 777 /var/lib/hudson
	sudo chmod –R 777 /usr/java/apache-tomcat-6.0.20/

Finally, we need to restart Hudson.

sudo /etc/init.d/tomcat restart

Create the Job

Finally, it is time to create our Hudson job.

  • Click on New Job in the upper left section
  • Give the job a meaningful name. Since we are creating a job to run our tests, let’s name it CosmicComixTests
  • Select the Build a free-style software project radio box, and click the OK button
  • Under the Source Code Management section, select Subversion.
  • Enter in the URL that we checked our code into: https://[VM INTERNAL IP]/svn/secureci/CosmicComix
  • Now, we can create our execution step. Add an Execute Shell build step

	export ANT_HOME=/usr/java/apache-ant-1.7.1

	Xvfb :99 -ac 2>/dev/null 1>&2 &
	export DISPLAY=:99

	cd CosmicComix
	cp -r app /var/www/
	ant clean
	ant runcukes

	python -u target/cucumber-html-report/report.js

	echo "Cucumber results can be found https://[VM INTERNAL IP]/hudson/job/CosmicComixTests/ws/CosmicComix/target/cucumber-html-report/index.html”

The above script does the following:

  • Sets our system variables
  • Setup up our virtual display
  • Deploys a fresh instance of our application
  • Runs the tests
  • Analyzes the results (python script
  • Links to the results

Before saving the job, we want to add in a Post Build Job. Select Plot Build Data, and create two data series. Enter in some appropriate header and storing data, and then create two data series to track the passes, and failures.

	File:	CosmicComix/target/junit_pass.out
	Label:	Pass
	File:	CosmicComix/target/junit_fail.out
	Label:	Fail


That is it. We have successfully setup a continuous integration job. Each time the tests or application is updated, and checked into subversion, this code will run. Additionally, this code can be run manually, by clicking the Build Now link or icon associated with the job.
We can test this out by checking out the code locally on our machine, making changes, and then committing them. First run the tests an initial time, and then try making changes. A future post will step through some simple testing techniques and utilize this CI infrastructure, walking through making changes, and seeing the results.

Leave a comment

Your email address will not be published. Required fields are marked *