有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Maven sure fail build在达到测试超时时,即使failonend设置为true

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

我使用的是Jenkins,所以fail-on-end被设置为true,这样所有未受影响的测试都会继续运行here

那么,只有在达到超时时,构建才可能立即失败,而在其他失败的情况下,最终会失败吗

  • JUnit-4.12
  • Maven-3.5
  • Surefire-2.22.2
  • Jave-8

共 (1) 个答案

  1. # 1 楼答案

    这一点在maven email group中得到了回答

    to fail the build immediately when timeout is reached

    这项功能已存在多年: 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

    to fail the ... when someone presses abort button on the jenkins

    这一点也存在于多个备选方案中(在全球范围内有所改变) 版本)。请参见详细页面 http://maven.apache.org/surefire/maven-failsafe-plugin/examples/shutdown.html

    如果Jenkins向Maven进程发送SIGTERM信号(相同 如CTRL+C),则工艺管道中的标准输入流变为 关闭,EOFEException由分叉的JVM和关机引起 被称为: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#shutdown 专家阿帕奇。org/surefire/maven故障保护插件/集成测试mojo。html#关机 如果想要杀死JVM,可以重新配置默认行为

    如果Jenkins将SIGTERM发送到Maven进程,则启用 流程检查器,请参阅文档中的更多详细信息: http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#enableProcessChecker http://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中找到线程转储,如here所述