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
Step1:-
Download the required JAR files from :-
ReportNG+Velocity
Guice-3.0
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
Step1:-
Download the required JAR files from :-
ReportNG+Velocity
Guice-3.0
![]() |
Downloading Guice-3.0.zip |
Step2:-
Unzip the JAR files and add to the project.
How to add JAR files in Eclipse
![]() |
Adding Guice JAR’s |
Step3:-
Add listener to testng.xml file
listener class-name=”org.uncommons.reportng.HTMLReporter”
JavaCode
XML file:-
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite" >
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
</listeners>
<test name="My first TestNG run using ReportNG">
<classes>
<class name="srcTest.FirstTest"/>
</classes>
</test>
</suite>
Note:-
Incase you are getting the below error,it can be due to missing JAR files in Guice, try adding them again.
![]() |
Code Error |
Step4:-
Observing the results,
test-ouput ->html->index.html
![]() |
index.html |
![]() |
Test Results in ReportNG |
Note:–
We can absorb Reporter.log messages inside output.html
![]() |
Reporter.log messages in ReportNG |