Configure TestNG Reports in Jenkins

In previous article, we have seen executing testng.xml from jenkins, Now we will publish the TestNG results using Jenkins TestNG Plugin. This plug-in allows us to publish TestNG results generated using org.testng.reporters.XMLReporter. It helps us see a summary of passed/fail tests as well as passed/fail configuration methods.

Once TestNG plug-in is configured, we can other also configure advanced properties like 'Show Failed Builds?', 'Mark build as unstable on Skipped config/test methods?', 'Escape exception messages?' etc. You can find more details in Jenkins testng-plugin

Let us now see how to configure 'testng-plugin for jenkins' and execute simple program to to see the TestNg Results.

Before proceeding to configure, make sure you have installed Jenkins testng-plugin. You can check here for more details on installing plug-in in Jenkins

After installing testng-plugin, you should be able to view the plug-in in list of installed plug-ins as below : -

testng jenkins plugin

Once it is done, now One step that we need to add to the previous article is to “Add post Build Action” and select “Publish TestNG Results” option.' [You only see this option once the plug-in is installed successfully]

testng post build

After selecting “Publish TestNG Results” option, you should be able to see TestNG XML report pattern which is filled with '**/testng-results.xml' as below along with 'Advanced' button.

testng results view

That's all we need to Publish TestNG Results in Jenkins. Now click on Build now to view TestNG results. Once the job execution is completed successfully, we should see a link to View TestNG Results as below:

testng results view

Advanced Parameters in TestNG Plugin

You can click on 'Advanced' button to configure other parameters if required. Example: In the options, if we select 'Mark build as unstable on Skipped tests?', Even if there is any single test is Skipped, it will mark the build as 'Unstable'.

testng results view

Here is how it shows the unstable build if result has skipped test after execution : -

testng results view

Hope this article helped you. Feel free to comment for any queries. Thank You.


Looking for TestNG results report in workspace using pattern: **/testng-results.xml Did not find any matching files.
I tried by Giving the complete path and with path with Forward Slash.
Test Success but Report is not getting added in Jenkins.

Add new comment

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.