In the previous tutorial, we have seen the Integration Of Jenkins With Selenium WebDriver. In this tutorial, we show you how to generate TestNG Reports Using Jenkins.
Pre-Requisite:-
Jenkins installed and started on the computer
Implementation Steps
Step 1: Start the Jenkins server and open the browser and navigate to the localhost and the port in which Jenkins is running
Step 2: Log in to Jenkins UI
Provide a username and password and click on the Sign-in Button.

Step 3: Download and Install TestNG Results Plugin
Click on the Manage Jenkins. Choose Manage Plugins.

Step 4: Add the TestNG Report plugin
On the Plugins Page, go to the Available option
- Select the TestNG Report Plugin
- Click on Install without restart. The plugin will take a few moments to finish downloading depending on your internet connection, and will be installed automatically.
- You can also select the option Download now and Install after the restart button. In which plugin is installed after the restart
- You will be shown a “No updates available” message if you already have the TestNG Report plugin installed.

The plugin “TestNG Report” has been installed successfully.

Sometimes, the installation fails because of a network issue. You can try to reinstall it, and it should be successful.
Step 5: Restart Jenkins
Click on the checkbox “Restart Jenkins when installation is complete when no jobs are running“.

The Jenkins will be restarted. Again, login to Jenkins UI.
Step 6: Create a new project using the Maven project plugin.
- Give the Name of the project.
- Click on the Maven project.
- Click on the OK button.
In the General section, enter the project description in the Description box.

Step 7: Build Management
Go to the Build section of the new job.
- In the Root POM textbox, enter the full path to pom.xml
- In the Goals and options section, enter “clean test”

Click on the Advanced button.
Step 8: Select custom workspace
Mention the full path of the project in the directory.

Step 9: Select “Publish TestNG Results” from “Post Build Actions“
Scroll down to ‘Post Build Actions’ and click on the ‘Add Post Build Actions’ drop-down list.
Select “Publish TestNG Results“.

Enter the TestNG XML Report Pattern as “**target/surefire-reports/testng-results.xml” and click on the “Save” button.

We have created a new project “TestNGReport_Demo” with the configuration to run TestNG Tests and also to generate TestNG Reports after execution using Jenkins.
Step 10: Execute the tests
Let’s execute it now by clicking on the “Build Now” button.

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

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

Step 11: View the TestNG Report
Click on the TestNG Results. It displays the summary of the tests.

This way, we could generate TestNG Reports using Jenkins.
Congratulations on making it through this tutorial and hope you found it useful! Happy Learning!! Cheers!!