Integration of Jenkins with Selenium WebDriver – Step by Step GuideGo Back
- Posted by TestOrigen Software Testing Services Pvt Ltd
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
- Open your web program and after that Navigate to Below URL
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.
3. Once downloaded, you will get Jenkins.War record that we have to execute.
Section 2-How to Design Jenkins Integration With Selenium WebDriver:
- Go to the location where Jenkins.war is available.
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
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 Configure the System
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
Uncheck Install automatically check box so Jenkins will just take java which we have specified previously.
Give the name as JAVA_HOME and Specify the JDK way.
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.
Once done click on “Save” and “Apply.”
Well done, your selenium webdriver integration with Jenkins designed at this point.
Want to attend our Software Testing Conference this year? Download our “Convince Your Boss” kit to get your boss to say YES!
Section 3-Execute Jenkins Selenium Webdriver TestNG
We can execute test cases in Jenkins utilizing four ways referred the beneath screenshot
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
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
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
B-Give, the Task-Name, select Build a free-form software project and Click on “OK” button
C-Navigate to Advanced Project Options > Check the utilization custom workspace > in index we will determine the project home catalog
D-Important part now determine the Add Build step >Click on Execute Windows batch command
E-In the area, please indicate the batch command which we made, and tap on Apply/save
3. you can at long last run the Build > Click on Build now alternative
4. Check Build history and Console output and confirm the outcome
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.