I heard that ReportNG creates a better report than TestNG's normal report. I tried to create ReportNG report, but failed. I am using Eclipse and I have downloaded ReportNG and added reportng-1.1.3.jar and velocity-dep-1.4.jar into classpath and written testng-suite.xml as below:
<suite name="SA" verbose="10">
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter" />
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />
</listeners>
...
</suite>
when I executed I could see the TestNG default report rather than ReportNG report. What else should I do to get ReportNG's report (like extend any class or implement listeners or write snippet of code)?
Also I heard that I have to use the command, useDefaultListeners="false" , but where should I include in the testng-suite.xml? Everyone is telling about ANT but I don't personally like it to use. So is there any way to include the above command into testng-suite.xml?
I am the author of ReportNG. You don't need to write any Java code to get it to work. You just need to be able to register listeners with TestNG from whichever tool you use.
I've only used ReportNG from Ant but other people have got it working with other build systems such as Maven and Gradle. I don't know if there is anything Selenium-specific that would prevent it from working. Are you getting any error messages? The first thing I would check is to make sure that the ReportNG JAR is on the classpath.
I didn't even realise that you could specify TestNG listeners in the testng.xml
file. However, I have just modified my sample reports to specify the listeners in this way rather than in the Ant build file and it works fine, so the problem is probably in the way you are configuring TestNG from Selenium.
How are you launching from Eclipse? You should be right-clicking on that XML file and select "Run as... TestNG suite". I'm assuming that's what you're doing.
Using default listeners should not have any impact on the problem you are seeing, I am guessing that some people use this because if they use ReportNG, they don't care about any of the other listeners that TestNG generates. Having said that, if you ever want to do this from Eclipse, you can simply edit the launch configuration that was created when you launched your suite as indicated above and add "-usedefaultlisteners false
" to the parameters box.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With