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.
Features
- 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
- Install Jenkins
- Follow instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins
- User Management
- Use LDAP Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/LDAP+Plugin
- To change standard Appearance to suite your organizational rules
- Use Simple Theme Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Simple+Theme+Plugin
- Use Dashboard View Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Dashboard+View
- To add and manage nodes
- Use Node and Label parameter plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/NodeLabel+Parameter+Plugin
- Use Multi Slave config plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Multi+slave+config+plugin
- Use Jenkins Slave Setup Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Slave+Setup+Plugin
- For Code Control
- Use Git Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
- Build
- Use Jenkins Gradle Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Gradle+Plugin
- Test Results
- Copy To Slave Plugin has Bug - JENKINS-14578 so we decided using NFS instead
- Use TestNG Results Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/testng-plugin
- Publish
- Use build-user-vars-plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Build+User+Vars+Plugin
- Use Jenkins Email Extension Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin
- Use Confluence Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Confluence+Publisher+Plugin
- Code Coverage Tool
- Use Jenkins Cobertura Plugin by following instructions given at https://wiki.jenkins-ci.org/display/JENKINS/Cobertura+Plugin
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 &
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
Dashboard
You can collect different statistics on a dashboard page as shown below
Also you can see from which build this test cases is failing when you dig the links in TestNG reports
Dashboard
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
Happy Testing :)
~Yagnanarayana Dande
Nice article. Jenkins is a great tool.
ReplyDeleteI got introduced to it when exploring Apache projects
https://builds.apache.org/