Menu Close
    Start a Project Request quote Reading list Switch to dark mode
    hyperlocal-marketplace-guide

    Generate ReportNG reports in Selenium WebDriver

    The reports generated by TestNG (default reports) are not much more readable and Interactive, and can’t be shown to the managers. ReportNG is a good add-on to generate Interactive and readable reports for selenium web-driver tests.

    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. It provides a simple, color-coded view of the test results. Setting up ReportNG is very easy. On top of it, the documentation generated is clear and easy to understand!

    Follow bellow given steps to generate ReportNG HTML report.

    STEP 1: Download and Add required Jar Files In Project’s Build path

    You need to download the bellow given jar files.

    • guice-3.0.jar
    • reportng-1.1.4.jar
    • velocity-dep-1.4.jar

    Reportng-1.1.4.jar ,Velocity-dep-1.4.jar files can be downloaded from reportng.uncommons.org.

    To download Guice-3.0.jar click github.com/google/guice and download the zip file.

    Now add these jar files to your project’s build path. To do so, follow the bellow given steps to Import them in your project’s build path.

    • Right click on the project which you need to add jar files in project explorer of eclipse > Go to “Build Path” > Select “Configure Build Path” > A project properties window with java build path tab selection will get open.
    • Go to “Libraries” Tab > “Add external JARs”. It will open Jar selection pop-up.
    • From here, navigate to “JarFiles” folder(Where all required jar files stored) and select all jar files and click on open button.
    • Click “OK” and you are done.

    STEP 2: Disable the default listeners of TestNG

    ReportNG uses two reporters pluggable into TestNG. JUnitXMLReporter generates XML summary of running tests. HTMLReporter creates human readable HTML report. So to run ReportNG reports the default TestNG listeners should be disabled. To disable default listeners of TestNG, follow the below steps.

    • Right click on project > Click on Properties > Click on TestNG

    • You will find an option as “Disable default listeners”, check the checbox.

    • Now Click on “OK” button.

    STEP 3: Add ReportNG listeners to testng.xml file.

    Create a testng file according to your project add the given code to your testng.xml as sown in the image.


    STEP 4: Execute your test and look the ReportNG reports.

    Now you are done with the process of adding ReportNG to your TestNG project. To execute the report, run your project. Refresh your package explorer and under your project you will see a “test-output” folder. Expand the folder, then expand a folder named “html”. Open the file ‘index.html’ .

    That’s all, you are done with adding  ReportNG reports to your testsuite.

    Happy testing 🙂

    . . .

    Comment

    Add Your Comment

    Be the first to comment.

    Back to Top
    css.php
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again
    Close

    Table of Content

    Hide Index