Thursday, February 18, 2016

Selenium : Add TestNg html Report mechanism in IntelliJet (can be used for all IDEs)

Add TestNg html Report mechanism in IntelliJet (can be used for all IDEs)


To use ReportNG reports we need to follow the below three steps: 

Step 1: Add the below Jars Files to your project.
  1. reportng-1.1.4.jar
  2. velocity-dep-1.4.jar
  3.  guice-3.0.jar
Step 2 : Add below listeners to your testng.xml file

<listeners>
      <listener class-name="org.uncommons.reportng.HTMLReporter"/>
      <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
  </listeners>

It should look like this :

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1" >
<listeners>
      <listener class-name="org.uncommons.reportng.HTMLReporter"/>
      <listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
  </listeners>
  <test name="Regression Test Suite"   >
    <packages>
      <package name="packOne" />
      <package name="packTwo" />
   </packages>
 </test>
</suite>
 

Step 3 : If you are using Eclipse - make sure reportNG reports, we need to disable the default TestNG Listeners.
It can be done by following the below steps:
1. Right Click on Properties
2. Click on TestNG
3. You will find an option as "Disable default listeners", check the checbox
4. Click on "Apply" button, it will show as message as "Project preferences are saved".
5. Now Click on "OK" button.

No comments:

Post a Comment