Implement ReportNG in TestNG

What is ReportNG?
ReportNG is a reporter add-on for TestNG that implements the report listener of TestNG. ReportNG reports provides better user interface(look and feel)compared to the original HTML reports. To generate a ReportNG report we have to add the reporting class to the list of listeners of TestNG while executing the tests. 
Lets implement this in our basic example that we have used in our First Test case with TestNG

Download the required JAR files from :- 

Download Guice for ReportNG

Unzip the JAR files and add to the project.
How to add JAR files in Eclipse

Guice-3.0 jar files adding in Eclipse
Adding Guice JAR’s 

Add listener to testng.xml file
listener class-name=”org.uncommons.reportng.HTMLReporter”


XML file:-

<!DOCTYPE suite SYSTEM "" >
<suite name="Suite" >
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<test name="My first TestNG run using ReportNG">
<class name="srcTest.FirstTest"/>

Incase you are getting the below error,it can be due to missing JAR files in Guice, try adding them again.

java.lang.NoClassDefFoundError: com/google/inject/Module
Code Error 

Observing the results,
test-ouput ->html->index.html

ReportNG results file in Eclipse
Fancy test results in TestNG using ReportNG
Test Results in ReportNG

We can absorb Reporter.log messages inside output.html

Reporter.log output in ReportNG
Reporter.log messages in ReportNG

Data Parameterization in Selenium using TestNG

Leave a Reply

Your email address will not be published. Required fields are marked *