如果测试失败,我可以对 Maven 集成测试结果运行后处理吗?

发布于 2024-10-04 17:32:04 字数 192 浏览 11 评论 0原文

我想扩展 maven2 POM 以对我的集成测试结果运行一些后处理。我添加了一个 java:exec 插件并将其绑定到 post-integration-test 阶段。

当测试通过时一切都很好,但如果我遇到任何测试失败,则不会执行后处理。

问题:无论集成测试阶段的结果如何,是否可以选择强制执行任务?

I want to extend a maven2 POM to run some post processing on my integration test results. I added a java:exec plugin and bound it to the post-integration-test phase.

All is fine when the tests pass but if I get any test failures then the post processing isn't executed.

Question: Is there an option to force a task, regardless of the results of the integration test phase?

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

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

发布评论

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

评论(1

时光瘦了 2024-10-11 17:32:04

我们的 POM 使用 Surefire 插件来执行集成测试,但看起来这是一个错误。 Failsafe 插件旨在解决这个问题。从文档中:

如果您使用 Surefire 插件来运行测试,那么当您测试失败时,构建将在集成测试阶段停止,并且您的集成测试环境将无法正确拆除。故障安全插件在构建生命周期的集成测试和验证阶段使用,以执行应用程序的集成测试。故障安全插件不会在集成测试阶段使构建失败,从而使集成测试后阶段能够执行。

http://maven.apache.org/plugins/maven-failsafe-plugin/

Our POM was using the Surefire plugin to execute the integration tests but it looks like that was a mistake. The Failsafe plugin is intended to address this issue. From the documentation:

If you use the Surefire Plugin for running tests, then when you have a test failure, the build will stop at the integration-test phase and your integration test environment will not have been torn down correctly. The Failsafe Plugin is used during the integration-test and verify phases of the build lifecycle to execute the integration tests of an application. The Failsafe Plugin will not fail the build during the integration-test phase thus enabling the post-integration-test phase to execute.

http://maven.apache.org/plugins/maven-failsafe-plugin/

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