Create First Jenkins Job for Automation Project

What is Jenkins? And, How Jenkins is useful in Automation Test?

Jenkins is open source automation server which is widely used to automate all type of Build activity. Jenkins is one of the popular tool for Continous Integration so it is used to schedule nightly jobs, trigger automation build on time basis or by polling git branches.  In this tutorial, we will create Jenkins job to trigger perodic automation build.

This tutorial will guide you by providing step by step explanation and snapshot. Refer below for step by step instruction.

Pre requisite:

  1. Jenkins should be installed on the machine and having credential of the user which have the the the right to create Jenkins Job.
  2. Automation Project should be completed and it should be running 
  3. Windows batch command to trigger from Command Line

Example: In this article, we used Selenium Automation Project which is maven based and we trigger using below command

cd <project root location>
mvn clean verify

Above command can be different for your project as it depends on the project configuration.

Steps to Create Jenkins Job for Selenium Automation Project:

Step 1: Start Jenkins Server: Go Jenkins installation folder and run jenkins.exe on windows or run below command

cd C:\Program Files (x86)\Jenkins
java –jar jenkins.war   (by default Jenkins will run port 8080)
or run on specfic port 
java –jar jenkins.war  --httpPort =9090   (Jenkins will run port 9090)
jenkins cmd

Step 2: Open Browser, navigate to Jenkins URL and login with credentials( as per Jenkins Tutorial 1)


Jenkins Login

Step 3: Now click on New Item to create New Item (in case of first it will open by default). Enter Project Name and click on Freestyle Project and click on OK.

Step 4: Choose according to Project but in this example project saved on the same machine so not required.

Step 5: Choose correct Source Code Management- In this example code available locally so we choose None.

Step 6: Build Triggers: This setting used to decide at what time our Automation Build will trigger. In present example, we schedule our job periodically. Period of jobs passed in cron-expressions. Refer below more insights:

Use below if you want  to trigger in every 15 min.

H/15 * * * *


# 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 *
Jenkins Jobs trigger
Jenkins build triggers

Step 7: Build Environment: 

Choose correct Build environment as per your requirement.

Jenkins Build environment

Step 8: Add Build Step:  In this section, we pass command line command which can invoke build. This command is equivalent to command line expression. 

Jenkins Execute Batch cmmand

Step 9: Add window batch command to trigger : 

Jenkins windows command

Step 10: Add Post Build Action: This section gives you flexibility to add step after post build execution. In this example, we added email after post Job execution. Email will be received once after job completion.

Jenkins email notification

Step 11: Enter email id in Recipients field and click on Save.

Jenkins email input

Step 12: Now Jenkins job is created. Go to Navigation Plane and click on Build Now.

Jenkins job build

Step 13: Go to Build History Area and click on correct build: 

Step 14: Go to Console Output and verify Console Log

Step 15: Go to Project Dashboard: On Project dashboard and blinking blob shows that currently build is running and cloud shows build success rate. It will be rainy if previous builds failed.

Well Done! By following above steps you created first free style job to trigger your automation build periodically. Hope you completed still if you face any issue then feel free to message us on @ThoughtCoders Facebook page. We will help you. 

If you want to learn more about Jenkins then refer our next tutorial on Jenkins.

Subscribe to our Newsletter:

0 0 vote
Article Rating

Subscribe to our Newsletter:

Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x
Open chat
Feel free to contact