Continuous Integration Testing with Jenkins

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

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.

jenkins automation steps

Now let’s take a look how to configure and manage Jenkins

Step 1

Download Jenkins from the website https://jenkins.io

Step 2

Login to the Jenkins
jenkins-open-source-automation-tool-1

E-Mail Configuration:

Step 3

Click on ‘Manage Jenkins’ link
jenkins-open-source-automation-tool-2

Step 4

Click on ‘Configure System’ link
jenkins-open-source-automation-tool-3

Step 5

Configure the fields given as screenshot
jenkins-open-source-automation-tool-4

Step 6

Enter ‘System Admin’ Email Id
jenkins-open-source-automation-tool-5

Step 7

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: your123@gmail.com

Reply To List: noreply@gmail.com

Default Content Type: $PROJECT_NAME – Build # $BUILD_NUMBER – $BUILD_STATUS!

jenkins-open-source-automation-tool-6

Step 8

Select the checkbox option given on the screen shot to Trigger the Email
jenkins-open-source-automation-tool-7

Step 9

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.

jenkins-open-source-automation-tool-8

Steps to create a new Project in Jenkins and Project Configuration

Step 1

Go to Jenkins -> New Item

Step 2

Enter project name and select ‘Freestyle Project’ then click on ‘OK’ button
jenkins-open-source-automation-tool-8

Step 3

Click on tab ‘General’

Step 4

Set the time on ‘Build Trigger’ Section
jenkins-open-source-automation-tool-9

Example Time:

# 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 *

Step 5

Enter the name of your .bat file on the ‘Build’ section
jenkins-open-source-automation-tool-10

Step 6

Fill the field on the ‘Post-build Actions’ section given as screenshot
jenkins-open-source-automation-tool-11
jenkins-open-source-automation-tool-12

Step 7

Click on ‘Save’ button

Step 8

Click on your Project then click -> Build Now; you will get the ‘Build Executor Status’ as following screenshot.
jenkins-open-source-automation-tool-13

Step 9

Once if the build get completed click on the build number then view the console output
jenkins-open-source-automation-tool-14

Step 10

The console output will be following screenshot
jenkins-open-source-automation-tool-16

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x