About ReportNG:
  1. ReportNG is a simple HTML reporting plug-in for the TestNG unit-testing framework.
  2. It reports provides better user interface(look and feel)compared to the original TestNG reports
  3. The default TestNG report which is not so easy to understand at-a-glance but reportNG provides a simple, color-coded view of the test results.
  4. In-order to generate a ReportNG report we have to add the reporting class to the list of listeners of TestNG while executing the tests.

Follow the steps to add this plugin to your framework or automation script:

Step 1: Download below mentioned Jars

Step 2 : After Downloading add jars into your referenced libraries

Step 3 :
The Most important step, to make sure reportNG reports, we need to disable the default TestNG Listeners in Eclipse.
Follow following the below steps:
  1. Right Click on Java Project and Click on Properties
  2. Click on TestNG
  3. You will find an option as "Disable default listeners", check the checkbox
  4. Click on "Apply" button, it will show as message as "Project preferences are saved"
  5. Now Click on "OK" button.

Step 4 :
  • Once you add above jars to your project, open your testng.xml file
  • In your testng.xml file add below xml tags at the top and save it.
<listeners>
    <listener class-name="org.uncommons.reportng.HTMLReporter"/>
    <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>

Step 5 : After adding listeners tags.your testng.xml likes below format

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Framework" verbose="1">
<listeners>
    <listener class-name="org.uncommons.reportng.HTMLReporter" />
    <listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
<test name="Sanity Test Suite">
   <packages>
        <package name="com.webTest.Tests"/>
   </packages>
</test>

</suite>
Categories: