In software development and testing fields, Continuous Integration (CI) is an exercise of combining all development work to a shared main server several times a day. The goal of CI is to reduce time and effort required for a product launch. The process of continuous integration is achieved with the help of version control, strategies & contracts and special tools.
One of the famous tools used for CI testing is Jenkins.
“Jenkins is an open source automation tool, which can be used to program all categories of tasks such as building, testing, and deploying software. Jenkins can be installed through native system packages, Docker, or even run standalone by any machine with the Java Run-time Environment installed.”
It helps to automate the non-human part of the software development life-cycle.
Jenkin pipeline is a package of plugins used for implementing the CI process in the delivery pipeline. Extensive set of tools are available with pipeline for modelling simple to complex delivery pipelines. It is a server based tool, which runs on Java servlet such as Apache Tomcat. It supports source control management such as AccuRev, CVS, Git, Mercurial, Subversion, RTC, Perforce and Clearcase.
There are a lot of plugins released for Jenkins to extend its use to projects, which are written in various languages besides Java.
Below is the flow diagram to explain how continuous integration testing can be done with Jenkins.
Now let’s take a look how to configure and manage Jenkins
Download Jenkins from the website https://jenkins.io
Login to the Jenkins
Click on ‘Manage Jenkins’ link
Click on ‘Configure System’ link
Configure the fields given as screenshot
Enter ‘System Admin’ Email Id
Enter the following fields on the ‘Extended Email Notification section –Ref’ screenshot
SMTP Server: smtp.gmail.com
Default user E-mail suffix: @gmail.com
Default Recipients: email@example.com
Reply To List: firstname.lastname@example.org
Default Content Type: $PROJECT_NAME – Build # $BUILD_NUMBER – $BUILD_STATUS!
Select the checkbox option given on the screen shot to Trigger the Email
Enter the fields on the ‘E-mail Notification’ section as given on the screenshot
Select ‘Test Configuration’ checkbox then click on ‘Test Configuration’ button. You will get success message like – “Email was successfully sent” [if you get this message means you have configured successfully] then Click on ‘Save’ button.
Steps to create a new Project in Jenkins and Project Configuration
Go to Jenkins -> New Item
Enter project name and select ‘Freestyle Project’ then click on ‘OK’ button
Click on tab ‘General’
Set the time on ‘Build Trigger’ Section
# every fifteen minutes (perhaps at :07, :22, :37, :52)
H/15 * * * *
# every ten minutes in the first half of every hour (three times, perhaps at :04, :14, :24)
H(0-29)/10 * * * *
# once every two hours at 45 minutes past the hour starting at 9:45 AM and finishing at 3:45 PM every weekday.
45 9-16/2 * * 1-5
# once in every two hours slot between 9 AM and 5 PM every weekday (perhaps at 10:38 AM, 12:38 PM, 2:38 PM, 4:38 PM)
H H(9-16)/2 * * 1-5
# once a day on the 1st and 15th of every month except December
H H 1,15 1-11 *
Enter the name of your .bat file on the ‘Build’ section
Fill the field on the ‘Post-build Actions’ section given as screenshot
Click on ‘Save’ button
Click on your Project then click -> Build Now; you will get the ‘Build Executor Status’ as following screenshot.
Once if the build get completed click on the build number then view the console output
The console output will be following screenshot