问题描述
我听说ReportNG创建一个比TestNG的常规报告一个更好的报告。我试图创建ReportNG报告,但未能成功。我使用Eclipse和我已经下载ReportNG并添加reportng-1.1.3.jar和速度-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的报告(如扩展任何类或实现监听器或写code的片段)?
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 =假,但在那里我应该包括在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?
推荐答案
要禁用defaultlisteners,转到Eclipse的项目 - >属性 - > TestNG的 - >魔鬼deafult听众
To disable defaultlisteners , goto Eclipse Project-> Properties -> TestNG -> Diable deafult listeners.
运行,您将结束与以下错误后:
After running you will end up with following error:
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)
要解决到你的classpath这一点,下载google-guice-3.0.zip和粘贴吉斯-3.0.jar。
to solve this, download google-guice-3.0.zip and paste guice-3.0.jar into your classpath.
现在运行,并检查工作区 /测试输出/ HTML的报告。
Now run and check the report in workspace/test-output/html.
这篇关于ReportNG不提供任何报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!