Thursday, 10 January 2013

ReportNG - HTML/XML Reporting Plug-in for TestNG


ReportNG is a simple HTML reporting plug-in for the TestNG unit-testing framework. It is intended as a replacement for the default TestNG HTML report. The default report is comprehensive but is not so easy to understand at-a-glance. ReportNG provides a simple, colour-coded view of the test results.

Disable the Default Listeners first

Project (right-click) > Properties > TestNG > Tick “Disable default listeners” > Apply > ok

The reportng-1.1.3.jar and velocity-dep-1.4.jar files must be included in the classpath to run the tests.

Download ReportNG (jar) files 
 Download reportng.jar
 Download velocity.jar

Check your project .classpath after build configure;

<classpathentry kind="lib" path="lib/velocity-dep-1.x.jar"/>
<classpathentry kind="lib" path="lib/testng-6.x.jar"/>
<classpathentry kind="lib" path="lib/reportng-1.1.x.jar"/>

Create the xml file by copying the below code: 

Right-click your Project/Class file > TestNG > "Convert to TestNG" > Edit the xml code by adding LISTENERS given below > Finish

<?xml version="1.0" encoding="UTF-8"?>
<suite name="Suite" parallel="false">
  <listeners>
      <listener class-name="org.uncommons.reportng.HTMLReporter"/>
      <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
  </listeners>
  <test name="Test">
    <classes>
      <class name="package.classname"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

Now run the TestNG framework by right clicking the .xml file from eclipse

Sample Report1 ReportNG
Sample Report2 ReportNG

14 comments:

  1. Hi,
    I followed the above steps, still I am not getting the ReportNg report.
    It just displays this:

    Generated by TestNG with ReportNG at 11:00 IST on Tuesday 23 July 2013
    Pankaj@Sushma-PC / Java 1.7.0_25 (Oracle Corporation) / Windows 7 6.1 (amd64)
    Test Results Report
    Groups
    spInternetSuite
    Duration Passed Skipped Failed Pass Rate

    ReplyDelete
  2. The following jar was required with ReportNG 1.1.4 and TestNG 6.8.


    com.google.inject
    guice
    3.0

    ReplyDelete
  3. Hi,

    I have followed the above mentioned steps to generate reportng but im not able to get it and added a following jars also ReportNG 1.1.4 and TestNG 6.8.

    ReplyDelete
  4. Replies
    1. You should try again to come to ground floor to consult with me.
      Aheer

      Delete
  5. add guice
    3.0 jar in your project

    ReplyDelete
  6. User pdfreport plugin for testng pdfreport generation which work same as reportng
    link https://github.com/uttesh/mavenrepos/tree/master/pdfreport

    ReplyDelete
  7. Refresh your project then will get html folder. in that go to index.html and open it in a web browser.

    Cheers.

    ReplyDelete
  8. Thanks for the great information in your blog Selenium Training in Chennai

    ReplyDelete
  9. For annotation tests in testNG, Is there any way we can display the description in reportNG html reports

    ReplyDelete
  10. Hi,

    Am added the required jar files and added


    in my xml file.
    When am trying ti run as testng suite it throws an error
    Listener org.uncommons.reporting.HTMLReporter was not found in project's classpath

    I checked in classpath and the following path is there as






    can you please tell me why am facing this issue.
    Please help.

    ReplyDelete
    Replies
    1. did you get any solution?

      Delete
  11. Hi, i am getting an error
    org.testng.TestNGException:
    Listener org.uncommons.reportng.HTMLReporter was not found in project's classpath

    although i have added all of these 3 jar files in my project and added listner tag in xml file

    ReplyDelete
  12. Amazing, thanks a lot my friend, I was also siting like a your banner image when I was thrown into Selenium.
    When I started learning then I understood it has got really cool stuff.
    I can vouch webdriver has proved the best feature in Selenium framework.
    thanks a lot for taking a time to share a wonderful article.
    Selenium Training in Velachery |

    ReplyDelete