问题描述
我听说 ReportNG 创建的报告比 TestNG 的正常报告更好.我尝试创建 ReportNG 报告,但失败了.我正在使用 Eclipse,我已经下载了 ReportNG,并将 reportng-1.1.3.jar 和 velocity-dep-1.4.jar 添加到类路径中,并编写了 testng-suite.xml,如下所示:
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>
当我执行时,我可以看到 TestNG 默认报告而不是 ReportNG 报告.我还应该做什么来获得 ReportNG 的报告(例如扩展任何类或实现侦听器或编写代码片段)?
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)?
我还听说我必须使用命令 useDefaultListeners="false" ,但我应该在 testng-suite.xml 中包含什么?每个人都在谈论 ANT,但我个人不喜欢使用它.那么有什么方法可以将上述命令包含到 testng-suite.xml 中呢?
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?
推荐答案
要禁用默认监听器,
Goto Eclipse Project-> Properties -> TestNG -> Disable deafult listeners.
运行后会报如下错误:
java.lang.NoClassDefFoundError: com/google/inject/Module
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetPublicMethods(Unknown Source)
at java.lang.Class.getMethods(Unknown Source)
要解决此问题,请下载 google-guice-3.0.zip 并将 guice-3.0.jar 粘贴到您的类路径中.
to solve this, download google-guice-3.0.zip and paste guice-3.0.jar into your classpath.
现在运行并检查 workspace/test-output/html 中的报告.
Now run and check the report in workspace/test-output/html.
这篇关于ReportNG 不提供任何报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!