Generate TestNG Reports Using Jenkins | Software Testing Material

In the earlier post, we have seen How To Run TestNG Scripts (testng.xml) Using Command Prompt and Using Batch file (.bat) . Also we have seen How To Run TestNG Scripts Using Jenkins . In this post, we show you how to generate TestNG Reports Using Jenkins. To do this, we need to have the following

i. TestNG Project
ii. Jenkins – Check this post on Installation of Jenkins .
iii. TestNG Results Plugin in Jenkins

Don’t Miss: Selenium Complete Tutorial

How To Generate TestNG Reports Using Jenkins

Let’s get started on How To Create TestNG Project.

Step 1: Creating TestNG Project. Follow this link to create TestNG Project .

Must Read: TestNG Complete Tutorial

Step 2: Installing Jenkins. Follow this link for  Installing Jenkins

We have TestNG Project and Jenkins ready. Moving forward to Step 3

Step 3: Installing TestNG Reports Plugin In Jenkins

Open Jenkins (localhost:8080) and click on ‘Manage Jenkins‘ and click on ‘Manage Plugins

Click on ‘Available‘ tab and select the check box against ‘TestNG Results Plugin‘ and click on ‘Install Without Restart

Open the ‘TestNGProject’ Job which we have created earlier. Refer this link on How To Create TestNG Project on Jenkins .

Click on ‘Configure’ and scroll down to ‘Post Build Actions’ and click on ‘Add Post Build Actions’ drop down list.

Select ‘Publish TestNG Results‘ 

Enter TestNG XML Report Pattern as ‘**/testng-results.xml‘ and click on ‘Save‘ button

We have created a new project ‘TestNGProject‘ with the configuration to run TestNG Tests and also to generate TestNG Reports after execution using Jenkins.

Let’s execute it now by clicking on ‘Build Now‘ button. It will invoke testng.xml from the batch file.

Right click on Build Number (here in my case it is #1) and click on Console Output to see the result.

Once the execution is completed, we could see a link to view ‘TestNG Results’

This way, we could generate TestNG Reports using Jenkins.

© 2021