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

37 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. Hi,

    I didn't get the report.

    ReplyDelete
    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. For annotation tests in testNG, Is there any way we can display the description in reportNG html reports

    ReplyDelete
  9. 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
  10. 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
  11. 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
  12. The infinity of software testing is on the accurate note. It contributes huge career forecasts for talented specialists to be skilled software testers.Thanks for the very gradually information.
    Selenium Training in Chennai
    Selenium Testing Training in Chennai

    ReplyDelete
  13. This comment has been removed by the author.

    ReplyDelete
  14. Hi,
    I am getting below error,
    Listener org.uncommons.reportng.HTMLReporter was not found in project's classpath
    at org.testng.TestNG.addListeners(TestNG.java:946)
    at org.testng.TestNG.initializeConfiguration(TestNG.java:912)
    at org.testng.TestNG.initializeEverything(TestNG.java:996)
    at org.testng.remote.support.RemoteTestNG6_12.initialize(RemoteTestNG6_12.java:22)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:97)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

    Any one able to resolve this issue?

    ReplyDelete
    Replies
    1. same error i am getting,,did u found any solution on it

      Delete
  15. Hi sir
    Am added the required jar files and added Listeners code
    in my xml file.

    I am getting below error,
    Listener org.uncommons.reportng.HTMLReporter was not found in project's classpath
    at org.testng.TestNG.addListeners(TestNG.java:946)
    at org.testng.TestNG.initializeConfiguration(TestNG.java:912)
    at org.testng.TestNG.initializeEverything(TestNG.java:996)
    at org.testng.remote.support.RemoteTestNG6_12.initialize(RemoteTestNG6_12.java:22)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:97)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

    ReplyDelete
  16. I would like to say thank you for the amazing details and concepts you are sharing in this.The style of writing is excellent and also the content is top-notch. Thanks for that shrewdness you provide the readers!

    Web Designer Training
    Cloud Training
    Android Training

    ReplyDelete
  17. we are looking to trade methods with others, why not shoot me an e-mail if interested.
    safety course in chennai

    ReplyDelete
  18. Excellent Blog. I really want to admire the quality of this post. I like the way of your presentation of ideas, views and valuable content. No doubt you are doing great work. I’ll be waiting for your next post. Thanks .Keep it up! Are you interested to buy luxury boxes... then click here Wallet Box | Perfume Box Manufacturer
    Candle Packaging Boxes
    Luxury Leather Box | Luxury Clothes Box
    Luxury Cosmetics Box | Shoe Box Manufacturer | Luxury Watch Box

    ReplyDelete
  19. Wow, what an awesome spot to spend hours and hours! It's beautiful and I'm also surprised that you had it all to yourselves!
    Kindly visit us @ Best HIV Treatment in India | Top HIV Hospital in India
    HIV AIDS Treatment in Mumbai | HIV Specialist in Bangalore
    HIV Positive Treatment in India | Medicine for AIDS in India

    ReplyDelete
  20. Appreciating the persistence you put into your blog and detailed information you provide.

    Oracle dba training chennai | oracle dba training course chennai

    ReplyDelete
  21. To be honest your article is informative and very helpful. Hp Laptop | Hp laptop online price

    ReplyDelete
  22. Thanks for sharing a valuable blog. Keep sharing. Python Training in Chennai

    ReplyDelete