Run TestNG with Jenkin

In this article we will explain how to control TestNg execution from Jenkin

Pre - Requisites:

  • Intellij is installed
  • Jenkin is installed
  • TestNGResults plugin is installed on Jenking.

Open Intellij and create a new maven project

Project is created, now we have to download Selenium and TestNG. We will add the dependencies of both and maven will download them for us.

Go to and search for Selenium and TestNG

Copy the dependencies on POM file and click on "Import Changes" , it will download all dependencies .

We we add a TestNg.xml file and change the PM as following.


<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE suite PUBLIC "" ""><suite name="BASHIR">
<test name="BASHIR">
<class name="MavenDemo.DemoTestNG">
<include name="googleSearch"/>

<?xml version="1.0" encoding="UTF-8"?><project xmlns=""         xmlns:xsi=""         xsi:schemaLocation="">




<!-- --> <dependency>

<!-- --> <dependency>








Open Jenkins. By default it will be ‘localhost/8080’

Click on ‘New Item’

Enter an Item Name of your preference. I gave the name as ‘MavenProject ‘. In the screenshot below, you could see the name as MavenProject (ignore it).

Select ‘Freestyle Project’ and click on OK button

Select GIT and clone the above created project using URL

Under the Build section, add the maven commands as below

Now configure the post actions as below to see the results.

and click on Save.

You are done with the configuration. Now click on "Build now"

From Console Output you can also view the outcomes of the test and finally you can view the test results form TestNgResults tab.