Maven 在达到测试超时时肯定会失败构建,即使失败设置为 true

嘟嘟车

在多模块 maven 项目中,我想打印线程转储并在达到测试超时时使测试失败。所以为了实现这一点,我使用了TimedoutTestsListenersurefire listener property的组合

我使用的詹金斯这样fail-on-end设置为true,这样所有的非冲击试验继续提到跑这里

那么,是否有可能仅在达到超时时立即使构建失败并且在其他失败情况下最终失败?

  • JUnit - 4.12
  • Maven - 3.5
  • 万无一失 - 2.22.2
  • 周 - 8
嘟嘟车

这个已经在maven邮件群里回答了

达到超时时立即使构建失败

此功能存在多年:http : //maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkedProcessTimeoutInSeconds http://maven.apache.org/surefire/maven-failsafe-plugin/integration -test-mojo.html#forkedProcessTimeoutInSeconds

失败......当有人按下詹金斯上的中止按钮时

这也存在于几个替代方案中(跨版本更改)。查看详细页面http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html

如果您的 Jenkins 将 SIGTERM 信号发送到 Maven 进程(与 CTRL+C 相同),那么进程管道中的标准输入流将关闭,并且 EOFException 被分叉的 JVM 捕获,并调用关闭:http://maven.apache。 org/surefire/maven-surefire-plugin/test-mojo.html#shutdown maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#shutdown如果你想杀死JVM,你可以重新配置默认行为。

如果您的 Jenkins 将 SIGTERM 发送到 Maven 进程然后启用进程检查器,请参阅文档中的更多详细信息:http: //maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker /maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#enableProcessChecker

有帮助吗?

这是常见问题解答:http : //maven.apache.org/surefire/maven-failsafe-plugin/faq.html

如果您对本主题有任何疑问,请随时提出任何问题。

如果您使用的是surefire 3.0.0-M4,则可以按照此处的target/surefire-reports说明找到线程转储

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章