About
ReportNG:
- ReportNG is a simple HTML reporting plug-in for the TestNG unit-testing framework.
- It reports provides better user interface(look and feel)compared to the original TestNG reports
- 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.
- 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
- reportng-1.1.4.jar download here
- velocity-dep-1.4.jar download here
- guice-3.0.jar download here
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:
- Right Click on Java Project and Click on Properties
- Click on TestNG
- You will find an option as "Disable default listeners", check the checkbox
- Click on "Apply" button, it will show as message as "Project preferences are saved"
- 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>