我如何轻松连接到 Maven 错误报告基础设施
我有一个 maven2 项目,我在集成测试阶段使用 exec 插件调用 vbscript 手动执行一些测试(这是 Windows 特定的测试)。这是由 Jenkins 自动化完成的。我想将这些测试的结果挂接到错误报告基础设施(surefire/failsafe)中,甚至可能在集成后测试阶段的构建失败之前提供有关测试失败的一些详细信息(最好通过标准的failsafe)机制)。我可以以某种方式创建自己的测试结果文件吗?有没有详细的格式说明?有更好的办法吗?
澄清一下,我追求以下几点:
- 能够向基础设施添加测试,以便 Jenkins 能够看到手动运行的测试数量。
- 能够将特定测试标记为通过或失败,并在詹金斯下适当地将构建标记为“不稳定”。
- 我不希望测试失败时构建立即失败(这会使应用程序继续运行)。我只想将其标记为“不稳定”或在“验证”阶段将其标记为失败。
I have a maven2 project where I am manually executing some testing in the integration-test phase using the exec plugin to call a vbscript (it's Windows specific testing). This is automated by Jenkins. I'd like to hook the results of these tests into the error reporting infrastructure (surefire/failsafe), and possibly even provide some details on the test failures before failing the build in the post-integration-test phase (preferably through the standard failsafe mechanism). Can I create my own test results file somehow? Are there any details on the format? Is there a better way?
Clarification, I'm after the following things:
- Ability to add tests to the infrastructure so Jenkins will see the number of tests run manually.
- Ability to mark specific tests as pass or fail and have the build marked as "unstable" under jenkins appropriately.
- I do not want immediate failure of the build when the test fails (this leaves the application running). I want to either mark it only as "unstable" or mark it as failed in the "verify" phase.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好的方法是将您的测试封装在自定义 mojo 中,该 mojo 可以利用内置的日志记录机制。然后你可以使用 javas run exec 来执行你的 vb,收集你的结果,并将它们打印到日志中。也许是这样的:
将其放入自己的项目中,然后将其包含在您的 pom 中:
这显然不是完整的解决方案,但可能会给您一个很好的起点。
The best way would be to encapsulate your test in a custom mojo which could leverage the built in logging mechanism. Then you could just use javas runtime exec to execute your vb, gather your results, and print them to the log. Something like this perhaps:
Put this in its own project, then include in your pom thusly:
This is clearly not the complete solution, but may give you a good starting point.