通过 Maven/Hudson 和 TestNG 使用多个类
我们在一个 test
文件夹中使用多个测试类。当我运行 mvn test
时,所有测试都会运行,并且我可以在 shell 中看到输出。但生成的 testng-results.xml 仅包含其中测试的最后一个类的结果。这对我来说还不错,但我们的 Hudson 服务器仅显示这些最后的结果,并且仅在最后一类中的一个测试失败时才将构建标记为失败。
如何使用 TestNG 将测试分为多个类,并将这些类聚合到 results-xml 中?
[更新] 刚刚发现此问题,但也没有答案。 [/更新]
We use several testing classes within one test
folder. When I run mvn test
, all tests are run and I can see the output in the shell. But the resulting testng-results.xml only has the results of the last class which was tested in it. This isn't too bad for me, but our hudson server only displays these last results and only marks a build as failed if one test within that last class failed.
How can I use TestNG with tests split over several classes which will be aggregated into on results-xml?
[update]
Just found this question, but also no answer. [/update]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不太确定 Hudson 发生了什么,但是您是否尝试过创建一个 testng.xml 文件并告诉 Surefire 使用该 testng.xml 文件,而不是仅仅发现与 Testjava 匹配的所有 Java 文件?
(只是在黑暗中拍摄)
你可以这样做:
I'm not quite sure what's going on with Hudson but have you tried creating a testng.xml file and telling Surefire to use that testng.xml file instead of just discovering all the Java files that match Testjava?
(just a shot in the dark)
This is how you do it:
在一个 testNg 文件中的单独标签中执行单独的测试类并使用 maven-surefire 2.5 插件
execute separate test classses in separate tags in one testNg file and use maven-surefire 2.5 plugin