Reputation: 31
I am using Selenium WebDriver + TestNG with java in Eclipse. I want to generate better report using ReportNG rather than normal TestNG report. I have configured the build path with reportng-1.1.2.jar and velocity-dep-1.4.jar. I have also disabled the default TestNG Report from Project > Properties > TestNG > "Disable Default Listeners" Presently I have created a testNg.xml file that runs my tests as complete Test Suite. The content of xml file is as below:
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite thread-count="5" skipfailedinvocationCounts="false" verbose="1" preserve-order="true" name="testingXML" junit="false" parallel="false" annotations="JDK">
<test verbose="2" name="com.src.com.pcrm.pageobjects.*" junit="false" annotations="JDK">
<testng classpathref="test-path"
outputdir="${test-results.dir}"
haltonfailure="true"
useDefaultListeners="false"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter">
<xmlfileset dir="." includes="testng.xml"/>
<sysproperty key="org.uncommons.reportng.title" value="My Test Report"/>
</testng>
<classes>
<class name="com.pcrm.pageobjects.HomeTest"/>
<methods>
<include name="testManadatoryFieldsOnHomePage"/>
<include name="testIsLogoDisplayed"/>
<include name="testUrlCheck"/>
</methods>
But When I executed this xml file it did not generate any ReportNG reports. What's the wrong? Help is appreciated.
Upvotes: 3
Views: 6476
Reputation: 1
STEP 1 : Download required Jar Files
from here :https://github.com/google/guice you can download below jar file
guice-3.0.jar
from here :http://reportng.uncommons.org/ you can download below jar files
reportng-1.1.4.jar
velocity-dep-1.4.jar
STEP 2 : Add Jar Files In Project's Build path
STEP 3 : Disable default listeners of testng
You need to disable default listeners of testng. To disable default listeners Right click on project folder In eclipse. Go to Properties. - It will open Properties dialog. Go to TestNG and check Disable default listeners--->Apply--->Ok
STEP 4: add these listners in TestNG.xml
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
STEP 5 : Execute test and view ReportNG reports(inside html folder html-->index.html(not outside index.html))
refresh your project folder. It will create/update test-output folder. Explore that folder then explore html folder. You will find index.html file Inside It. To open index.html file.
Upvotes: 0
Reputation: 489
you may try this TestNG-XSLT report, it look greater and easier to read.
Upvotes: 1
Reputation: 54515
My best guess is that it's a classpath issue. Make certain that the ReportNG and Velocity JARs are on the classpath. See this related question about a similar problem using ReportNG with Selenium.
Upvotes: 2