Integration of Jenkins with Selenium WebDriver – Step by Step Guide

Selenium is a very well-known tool utilized for automated testing of web applications. One stage ahead, incorporating the Selenium Jenkins integration takes it to the next level.

Jenkins is an open source tool written in Java. It gives the tester a constant conveyance and consistent integration benefit for software advancement. Additionally, it automates your manual task of code arrangement process from advancement box – QA – Stage – Production.

Jenkins has numerous modules which you can coordinate, for example, Git, SVN; manufacture the pipeline and some more.

The main functionality of Jenkins is to execute a predefined rundown of steps on the premise of time and a few events.

For example, when you want to construct the execution relying on time you can run work at regular intervals, or if you need to build it concerning an event, you can do as such after another confer in a Git repository.

Benefits of selenium Jenkins integration are:

  • It is a cross-stage and can utilize on Mac OS, Windows, Linux, and Solari conditions.
  • It is a free and open source tool.
  • Utilized and all around reported.
  • Reconciliation with the wide assortment of technologies and tools.

Step by step guide of Selenium Jenkins integration:

 

Section 1-Download Jenkins

  1. Open your web program and after that Navigate to Below URL

http://jenkins-ci.org

This is the official site of Jenkins

2. Once ready, download Jenkins.War record and save to desktop or some other area relies on your decision.

 

Second Step-Now download Jenkins.war record and save to desktop or some other area relies upon your decision. selenium jenkins integration

 

3. Once downloaded, you will get Jenkins.War record that we have to execute.

 

Third Step-Once download totally You will get. selenium jenkins integration

 

Section 2-How to Design Jenkins Integration With Selenium WebDriver:

 

  1. Go to the location where Jenkins.war is available.

 

Go to the location where Jenkinswar is accessible. selenium jenkins integration

 

2. Open Command incite knows as CMD and explore to project home catalog and Start Jenkins selenium server

Begin cmd> Project_home_Directory> java – jolt Jenkins.war

Open Command incite knows as CMD and explore to project home catalog and Start Jenkins selenium server. selenium jenkins integration

Open Command incite knows as CMD and explore to project home catalog and Start Jenkins selenium server 2. selenium jenkins integration

 

3. Once the Jenkins server is up and running; you will get a success message.

By default, Jenkins will run on 8080 port so you can explore beneath URL for Jenkins UI

Open any program and sort the URL http://localhost:8080

Presently Jenkins in up and running so now we need to arrange Jenkins with the goal that we can execute our test case using Jenkins selenium plugin.

4.  When Jenkins in selenium is running so; we are practically finished. However, before moving to create build we have to design Jenkins with the goal that Jenkins can recognize different tools also like Java, Maven and so forth.

Tap on > Manage Jenkins

Tap on Manage Jenkins. selenium jenkins integration

Tap on Configure the System

Tap on Configure System. selenium jenkins integration

 

Here we are disclosing to Jenkins that our java situated at this location, so we don’t need to stress over the precise way.

Explore to JDK area and Click on Add JDK button

 

Explore to JDK area and Click on Add JDK button. selenium jenkins integration

Uncheck Install automatically check box so Jenkins will just take java which we have specified previously.

 

Uncheck Install automatically check box so Jenkins will just take java which we have specified previously. selenium jenkins integration

Give the name as JAVA_HOME and Specify the JDK way.

Give the name as JAVA HOME and Specify the JDK way. selenium jenkins integration

 

In selenium continuous integration Jenkins, we have a decent component that you can arrange email notice for the client.

This is discretionary yet in a case you need to design Email notification then you need to do small setting while at the same time arranging Jenkins

Refer to screenshot you can change login details and tap on Apply.

Refer to screenshot you can change login details and tap on Apply. selenium jenkins integration

Once done click on “Save” and “Apply.”

Well done, your selenium webdriver integration with Jenkins designed at this point.

 

Section 3-Execute Jenkins Selenium Webdriver TestNG

 

We can execute test cases in Jenkins utilizing four ways referred the beneath screenshot

Execute Jenkins selenium webdriver TestNG. selenium jenkins integration

In this post, we will execute utilizing Window batch command

1.Create a batch document first then we will add a similar cluster record to Jenkins. Let’s divide the first into a,b,c parts:

A-To makes the batch document we have to set classpath of TestNG so we can execute testng.XML records

Our task structure should resemble

 

A-To makes the batch document we have to set classpath of TestNG so we can execute testngxml records. selenium jenkins integration

 

B-Open command provokes and set the classpath-

While setting classpath, we will set the way of canister envelope and libs organizer

Home index > set classpath=C: \Users\Learn-automation\bin;C:\Users\Learn-automation\libs\*;

C-Open notepad and write the underneath command and save as .bat document-

java – cp bin;libs/* org.testng.TestNG testng.XML

C-Open notepad and write the underneath command and save as bat document. selenium jenkins integration

2.Make a task in Jenkins which will execute our build

Open Jenkins on program (sort http://localhost:8080)

A-Click on the new thing

 

A-Click on the new thing. selenium jenkins integration

B-Give, the Task-Name, select Build a free-form software project and Click on “OK” button

Give the Task-Name select Build a free form software project and Click. selenium jenkins integration

C-Navigate to Advanced Project Options > Check the utilization custom workspace > in index we will determine the project home catalog

 

Navigate to Advanced Project Options. selenium jenkins integration

D-Important part now determine the Add Build step >Click on Execute Windows batch command

 

Important part now determine the Add Build step. selenium jenkins integration

E-In the area, please indicate the batch command which we made, and tap on Apply/save

In the area please indicate the batch command which we made. selenium jenkins integration

3. you can at long last run the Build > Click on Build now alternative

 

you can at long last run the Build. selenium jenkins integration

 

4. Check Build history and Console output and confirm the outcome

 

Fourth Step-Check Build history and Console output and confirm the outcome 1. selenium jenkins integration

 

Fourth Step-Check Build history and Console output and confirm the outcome 2. selenium jenkins integration

Fourth Step-Check Build history and Console output and confirm the outcome 3. selenium jenkins integration

Selenium Jenkins integration gives you to run your script each time there is any change in software code and conveys the code in another condition. With Jenkins, you can save execution history and test reports.

So, trigger selenium from Jenkins is extremely valuable when you have test cases prepared, and you need them to run utilizing a single click. We can make or calendar a work to run the test cases using a batch document.

About the Author

TestOrigen Software Testing Services Pvt Ltd

Find out more about @archana-yadav