The most popular tool in this genre would be “Jenkins“. It is an open source continuous integration tool that is very popular now a days for continuous deployment.
Well I would be explaining my viewers today how can you use Jenkins to run your tests automatically.
I am using an Ubuntu 16.04 machine. So I would be explaining the installation as per Debian standard.
- To install Jenkins in Ubuntu please follow the following set of instructions
wget -q -O - https://pkg.jenkins.io/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins
- After installation if you want to upgrade your Jenkins to the latest version you can follow the following set of instruction.
sudo apt-get update sudo apt-get install jenkins
- Java should be installed within the system with its class path set.
- Maven should be installed within the system with its class path set. For those who have no idea about maven let me just brief you about maven. It is a build tool that helps running your automation tests independent of any platform.
- Jenkins should be installed within the system. If Jenkins is locally installed then it will be running on port 8080.
- Eclipse should be up and running.
- Github should be installed within your system.
Creating a maven project using eclipse:
To create a maven project using eclipse follow the required steps
Step-1: After opening eclipse goto File > Project > Maven Project. Follow the screenshot
Step-2: Set artifact id for archetype to ‘quickstart‘. Follow the screenshot
Step-3: Add a group id name and a artifact id name. These would basically be your packages under which you will be writing your tests. After this click on finish. Follow the screenshot.
Once your maven project is configured the directory structure would look something like this.
Now once your code is up and running push it to git hub and then we can configure Jenkins to run your automation code from git hub itself.
Setting up Jenkins:
To set up Jenkins please follow the steps.
Step-1: Create a new project by clicking ‘New Item‘
Step-2: Select the option ‘Maven project‘. Give the name of the project and click on ok.
Step-3: Provide a description of the project if you want to. Next select Git as the option for Source Code Management.
Also enter the ‘repository url‘ and the ‘branch‘ on which the updated code is present
Step-4: Give the path of your root POM within the project and set the goal to clean install. This would basically make a clean build each time the script is executed. For first time you can set ‘clean install‘ for ‘Goals and Options‘. The next time you run the script you can change it to ‘clean test‘.
Step-5: Next if you click on the option ‘Build Now‘ on your extreme left the build would start and it would look something like this.
Now to remove complete dependency for triggering the Jenkins build you can set up a scheduler for Jenkins that would schedule the job to be build at a continuous period of time. Follow the screenshot to understand.
You can also trigger the Jenkins build when a code is pushed onto git hub by checking the option “Build when a changed is pushed to GitHub“. Follow the screenshot to understand
Soumyajit is 5+ years experienced Software professional with his prime focus on automation technologies based on quality development and takes interest in the CI/CD processes. He provides help in developing the QA process in an organization with his skills in automation for the web platform. His focus is on improving the delivery process for an ongoing project and connects the dot to help out with a successful deployment. He has experience in working on analytics, e-commerce, and the ad-tech domain.
Besides being a professional he takes an immense interest in learning new skills and technologies. He is a research guide author/writer at Dzone and Web Code Geeks. He also maintains a blog platform of his own where he likes to keep up his technology junks.