ReportNG不提供任何报告

发布于 2024-11-15 13:54:10 字数 668 浏览 3 评论 0原文

我听说 ReportNG 创建的报告比 TestNG 的正常报告更好。我尝试创建 ReportNG 报告,但失败了。我正在使用 Eclipse,我已经下载了 ReportNG 并将 reportng-1.1.3.jar 和velocity-dep-1.4.jar 添加到类路径中,并编写了 testng-suite.xml,如下所示:

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

当我执行时,我可以看到 TestNG 默认报告,而不是报告NG报告。我还应该做什么来获取 ReportNG 的报告(例如扩展任何类或实现侦听器或编写代码片段)?

我还听说我必须使用命令 useDefaultListeners="false" ,但是我应该在 testng-suite.xml 中包含什么?每个人都在谈论 ANT,但我个人并不喜欢使用它。那么有没有办法将上面的命令包含到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>   

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清音悠歌 2024-11-22 13:54:10

我是 ReportNG 的作者。您无需编写任何 Java 代码即可使其工作。您只需要能够从您使用的任何工具向 TestNG 注册侦听器即可。

我只使用过 Ant 的 ReportNG,但其他人已经让它与其他构建系统(例如 Maven 和 Gradle)一起工作。我不知道是否有任何特定于 Selenium 的东西会阻止它工作。您收到任何错误消息吗?我要检查的第一件事是确保 ReportNG JAR 位于类路径上。

我什至没有意识到您可以在 testng.xml 文件中指定 TestNG 侦听器。然而,我刚刚修改了我的示例报告,以这种方式而不是在 Ant 构建文件中指定侦听器,并且它工作正常,因此问题可能出在您从 Selenium 配置 TestNG 的方式上。

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.

我不会写诗 2024-11-22 13:54:10

您如何从 Eclipse 启动?您应该右键单击该 XML 文件并选择“运行为... TestNG suite”。我假设这就是你正在做的事情。

使用默认侦听器不应该对您所看到的问题产生任何影响,我猜测有些人使用它是因为如果他们使用 ReportNG,他们不关心 TestNG 生成的任何其他侦听器。话虽如此,如果您想从 Eclipse 执行此操作,您只需编辑启动套件时创建的启动配置(如上所述),并将“-usedefaultlisteners false”添加到参数框中。

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.

坠似风落 2024-11-22 13:54:10

要禁用 defaultlisteners ,

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 粘贴到您的类路径中。

现在运行并检查 workspace/test-output/html 中的报告。

To disable defaultlisteners ,

Goto Eclipse Project-> Properties -> TestNG -> Disable 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) 

to solve this, download google-guice-3.0.zip and paste guice-3.0.jar into your classpath.

Now run and check the report in workspace/test-output/html.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文