Integrate Selenium with Jenkins

Please visit my website and subscribe to my youtube channel for more articles

Software Used in Selenium


Please use the source code link, clone it and run the mvn test on your machine.

Jenkins Configuration

  1. Create a freestyle job, in scm — use the link mentioned above -> in build section -> add clean test -> save ->trigger
Image for post
Image for post
Image for post
Image for post

HOw to run selenium on chrome. click here

See the below steps if you want to know how to configure a sample project in eclipse to run selenium scripts.

  1. Download eclipse from here
Image for post
Image for post

6. Click Next and select create a sample project

Image for post
Image for post
Image for post
Image for post

7. Project created successfully.

8. Add TestNG Plugin in Eclipse.

Install from update site

  • Select Help / Install New Software…

10. Create a new TestNg Class

Image for post
Image for post

package example;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

import org.testng.Assert;

import org.testng.annotations.Test;

import org.testng.annotations.BeforeTest;

import org.testng.annotations.AfterTest;

public class NewTest {

private WebDriver driver;


public void testEasy() {


String title = driver.getTitle();

Assert.assertTrue(title.contains(“Demo Guru99 Page”));



public void beforeTest() {

driver = new FirefoxDriver();



public void afterTest() {




Right-click on the WebdriverTest and select TestNG | Convert to TestNG.
Eclipse will create testng.xml which says that you need to run only one test with the name NewTestas shown in the following screenshot:

Image for post
Image for post

Now you need to run test through this testng.xml.

So, go to the Run Configurations and create a new launch TestNG, select the project and field Suite as testng.xml and click Run

Image for post
Image for post

Build finished successfully

Now run as maven test.

Written by

Devops Automation Enginneer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store