Next-Gen App & Browser Testing Cloud
Trusted by 2 Mn+ QAs & Devs to accelerate their release cycles

Learn how to generate TestNG report in Jenkins in our latest blog. You will also learn how to share these TestNG reports in Jenkins through email. Generate & share a Jenkins Selenium report seamlessly!
January 11, 2026
TestNG is an open-source automated testing framework, where ‘NG’ of TestNG is Next Generation. It is similar to JUnit but designed to be better than JUnit, especially when testing integrated classes. With the help of simple annotations, grouping, sequencing & parametrization, TestNG overcomes most of the older system’s limitations and gives the developer the ability to write more versatile and efficient tests.
In our previous blogs, we have seen how to run Selenium tests in TestNG using an XML file, Parameterisation in TestNG, TestNG listeners, and much more. In this blog, we will find out how to generate a TestNG report in Jenkins. This will be particularly useful if you are into Selenium test automation.
The TestNG.xml file is central to configuring and managing TestNG test suites in Java. Using Eclipse, developers can easily create, organize, and execute test cases efficiently.
What Is the TestNG.xml File?
The TestNG.xml file defines how tests are grouped, executed, and reported. It specifies test classes, methods, and configurations, enabling controlled and repeatable test execution.
Different Tags in a TestNG.xml File
TestNG.xml uses several tags to organize tests:
Setting Up a TestNG Project in Eclipse
Begin by creating a Java project in Eclipse, adding the TestNG library via Maven or manually, and ensuring your project structure follows standard Java conventions.
How to Create a TestNG.xml File in Eclipse?
Right-click your project → New → Other → TestNG → TestNG Suite. Name your XML file and select the classes and methods to include. Eclipse automatically generates the XML with proper tags for execution.
TestNG is quite popular among developers and testers for test creation. It offers several practical features like grouping, dependence, prioritization, ease of using multiple annotations, etc. If you are not a fan of TestNG, allow me to introduce you to a few of the several benefits offered by it, especially from Selenium perspective-
Primarily, developers use annotation repeatedly to define a piece of code that is incorporated into the software or business logic used in the programming language Java to control the flow of methods. In Test Next Generation (TestNG), annotations play a significant role. When working on TestNG, testers need to consider the operations and uses of each annotation.
Although Annotations differ from project to project depending on their requirements, the execution flow remains intact for every single project. Below are different Annotations present in TestNG and their primary usage:
There are several benefits of the available TestNG Annotations–
Watch this video to learn about the TestNG Annotations and how they help provide better structure and readability to the code.
Writing a Basic Test in TestNG
Now that we have essential elements in place let us see the primary steps involved in creating a TestNG test.
Note: TestNG requires JDK 8 or higher. You can refer to our complete TestNG Tutorial to start from the basics.
Below is a straightforward test is written in TestNG:
package example1;
import org.testng.annotations.*;
public class SimpleTest {
@BeforeClass
public void setUp() {
// here would be the code that will be invoked when this test is instantiated
}
@Test(groups = { "fast" })
public void aFastTest() {
System.out.println("Fast test executed");
}
@Test(groups = { "slow" })
public void aSlowTest() {
System.out.println("Slow test executed");
}
}
Using @BeforeClass and @Test, i.e., after the test class is built & before any test method is run, the setUp() method will be invoked. We will run the group quickly in this example, so aFastTest() is invoked while a SlowTest() is skipped.
Things to Note:
We can either invoke our test using the command line, the ant task (as shown below), or the XML file: once you have compiled your test class into the build directory.
<project default="test">
<path id="cp">
<pathelement location="lib/testng-testng-5.13.1.jar"/>
<pathelement location="build"/>
</path>
<taskdef name="testng" classpathref="cp"
classname="org.testng.TestNGAntTask" />
<target name="test">
<testng classpathref="cp" groups="fast">
<classfileset dir="build" includes="example1/*.class"/>
</testng>
</target>
</project>
Use ant to invoke it:
c:> antBuildfile: build.xml
Output

The test results can be browsed using:
start test-output\index.html (on Windows)
If you don’t like this process of getting the test results, there’s an easier way to do it. It is also possible to generate the TestNG reports in Jenkins. There is a plugin Jenkins offers to accomplish this task. The plugin is the TestNG Results plugin. This next section will find out how to generate TestNG report in Jenkins with this plugin.
You might also like- Generate PHPUnit Coverage Report In HTML and XML

Deliver immersive digital experiences with Next-Generation Mobile Apps and Cross Browser Testing Cloud
With TestNG certification, you can challenge your skills in performing automated testing with TestNG and take your career to the next level.
Here’s a short glimpse of the TestNG certification from TestMu AI:
TestNG Results plugin enables you to publish the results of TestNG created using org.testng.reporters.XMLReporter.TestNG The resulting XML file contains more details than the XML file of the JUnit framework. In graph and table reports, this plugin reveals such additional information. The plugin also makes it possible to import the XML TestNG reports in Jenkins from each build.
Now getting to the ‘how’ part of ‘how to generate TestNG report in Jenkins’- data is parsed using the output that org.testng.reporters.XMLReporter generates. The results are shown with a trend graph, and all the specifics of the failed tests are also presented. And that’s how TestNG reports in Jenkins look like!
Let’s find out more about a Jenkins Selenium report.
A Jenkins Selenium report generated using TestNG Results plugin offers the following features-



Watch this video to learn how TestNG has become one of the most robust test automation frameworks and all you need to know to get started with TestNG in Selenium.
Using this plugin is very straightforward once you have configured your build to run TestNG-based test cases and figured out how to generate TestNG report in Jenkins. Simply trigger Publish TestNG Results in Post-Build Behavior.
This option enables the following properties to be configured:
9 Of The Best Reporting Tools For Selenium

Now let us see how to generate TestNG Report in Jenkins. To be able to do this, you need to have all the required tools in your system.
Prerequisites-
Once you have all this installed, we can get started with a TestNG Project.
In order to generate TestNG reports in Jenkins, we need to start from scratch. First, we will create a TestNG project. To create a TestNG project, you will need to follow the steps mentioned below-
Step 1: Open Eclipse and create a Java class.
Step 2: Keep all the library files in a folder.
Step 3: Write a Java program.
The below snippet highlights all the three steps mentioned above.

Step 4: Now convert the Java Program into TestNG.

Alternative Method- Another way you can create a TestNG Project is by creating a new TestNG project all from the beginning.
Step 1: Click File –> New –> Java Project

Step 2: Give it an arbitrary Project Name, say “FirstTestNGProject” and then click Next.

Step 3: Next step is to start importing the TestNG Libraries into the project. Click on the “Libraries” tab –> “Add Library”

Step 4: Choose “TestNG” on the Add Library dialog, and click Next.

Step 5: Click on Finish.

It should be noticed that TestNG is included on the Libraries list.

Step 6: The JAR files containing the Selenium API will now be added. These files are located in the Java client driver we downloaded from http://docs.seleniumhq.org/download/.

Then, navigate to where the Selenium JAR files are placed.

After adding the external JARs, the screen should appear like this.

Step 7: Click on Finish and confirm that our FirstTestNGProject is visible on Eclipse’s Package Explorer window.

After we have the TestNG project, the next step is to install Jenkins. You can refer to the guided steps for Jenkins installation in our Jenkins Tutorial.
Now that we have TestNG Project and Jenkins platform ready, the next step is to install TestNG Reports Plugin in Jenkins.
The next and the most crucial step to know how to generate TestNG report in Jenkins is to install the TestNG Reports plugin. To install the plugin in Jenkins, follow these steps-






There you go- that’s how to generate TestNG Report in Jenkins!
There’s another way to set up the TestNG reports in Jenkins Dashboard.




In the sections above, we saw how to generate TestNG report in Jenkins or Jenkins Selenium report, as some like to call them. Once you have generated those TestNG reports in Jenkins, what would you like to do with them? The ultimate goal of generating a Jenkins Selenium report is to share them!
There is a possibility to send those email notifications directly from Jenkins along with the generated TestNG reports. In this section, we will learn how to email the generated Jenkins Selenium report to team members, leads or even managers.
Let’s see how we can accomplish this-
http://localhost:8080).

![]()

Yay! You are all set to send the email notification for TestNG reports in Jenkins!!
Now it’s time to test this.

Give the Project Description and select ‘Execute Batch Command’ from the Build drop-down and enter any invalid commands as shown in the image below, as each unstable build will receive an email. (Then only email alerts will be sent if the build fails).




Now that we are confident our email notifications are working, let us configure Jenkins to attach a TestNG Report in the Email.




And here you go. Now you are ready to generate TestNG reports in Jenkins & share those Jenkins Selenium reports!
I hope this blog has helped you take report generation and sharing one step ahead. Now you not only know how to generate TestNG report in Jenkins, but you have also learned how to share those TestNG reports in Jenkins via Email. It’s time to elevate Jenkins & TestNG’s functioning by sending out the email notification with your very next Jenkins Selenium report. If you’re looking to enhance your TestNG skills further, check out our comprehensive TestNG interview questions answers guide here. Let me know how it goes in the comments section below.
Happy testing!

Author
Did you find this page helpful?
More Related Hubs
TestMu AI forEnterprise
Get access to solutions built on Enterprise
grade security, privacy, & compliance