Monday, July 22, 2013

Jenkins - A Centralized Tool to run your Automated Tests

Most of the times Test team will end up writing different test harnesses to test different components and there should be  a platform from which a user can start a run of specific automation suite on a specified environment with given configurations remotely using a web page. For achieving this and other features listed below I was given a task by my manager to design a Tool. 

I have selected Jenkins and customized it to achieve this. 

  • Single Sign-on for all your Automation Needs
  • Common Console for starting any Automation Run
  • Configure all your Automation Suites from a single place
  • Horizontal coverage by adding all automation suites 
  • Vertical dig down possible for an Automation Engineer to understand root cause for Test failures
  • Email Notification once run in completed
  • Confluence Page is updated with results/custom message once run is completed
  • Code Coverage can be published
How to Achieve this
  1. Install Jenkins 
    1. Follow instructions given at
  2. User Management
    1. Use LDAP Plugin by following instructions given at
  3. To change standard Appearance to suite your organizational rules 
    1. Use Simple Theme Plugin by following instructions given at
    2. Use Dashboard View Plugin by following instructions given at  
  4. To add and manage nodes
    1. Use Node and Label parameter plugin by following instructions given at
    2. Use Multi Slave config plugin by following instructions given at
    3. Use Jenkins Slave Setup Plugin by following instructions given at
  5. For Code Control
    1. Use Git Plugin by following instructions given at
  6. Build
    1. Use Jenkins Gradle Plugin by following instructions given at
  7. Test Results
    1. Copy To Slave Plugin has Bug - JENKINS-14578 so we decided using NFS instead
    2. Use TestNG Results Plugin  by following instructions given at
  8. Publish
    1. Use build-user-vars-plugin by following instructions given at
    2. Use Jenkins Email Extension Plugin by following instructions given at
    3. Use Confluence Plugin by following instructions given at
  9. Code Coverage Tool
    1. Use Jenkins Cobertura Plugin  by following instructions given at

Adding a New Slave

  1. As a first step add a slave node in Jenkins UI

Start Slave process

  • wget http://[your jenkins host]:[port number]/jnlpJars/slave.jar
  • ${NOHUP} ${JAVA} -jar slave.jar -jnlpUrl http://SERVERNAME:PORT/computer/USER__NODENAME/slave-agent.jnlp &

Then you can see the slave at Slaves Page

Configuring a New Project

  • Fill the Project name, description for the project and Location of code on github
  • Add Parameters required for the project to run. So these are called as build Parameters, which means these will change per build.
  • Bind this project to a given node
  • Use Custom workspace to parse your results
  • Give the build steps
  • Specify files to be processed by testng-plugin for giving results and to create trend graph
  • Create an editable e-mail notification as a Post Step so that it sends email notification to selected people in the organisation in the given format
  • Create a Publish Task as Post build step to publish your results in Confluence

Your centralized Tool is ready and you can run your Automated Tests now :) 

Build Now(Run Tests)

From left hand pane in the project page say "Build Now" and it will take you to following screen

Now give the build parameters and say build. This will start running your test cases.

Tests' output in Console

You can have a look at the running tests in the console (Select console from Left Pane) as shown below

Also once tests are completed you can see the TestNg reports and Trends as shown below

Also you can see from which build this test cases is failing when you dig the links in TestNG reports


You can collect different statistics on a dashboard page as shown below

Also an email Notification is sent after the run

Confluence Update

After every run it will update the results in the configured confluence page

Happy Testing :)

~Yagnanarayana Dande

1 comment:

  1. Nice article. Jenkins is a great tool.
    I got introduced to it when exploring Apache projects