即使测试失败,Jenkins JUnit插件也将生成报告为不稳定 [英] Jenkins JUnit Plugin reports a build as unstable even if test fails

查看:151
本文介绍了即使测试失败,Jenkins JUnit插件也将生成报告为不稳定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在使用Jenknis JUnit解析器插件来解析测试结果.我的工作只有一项测试,并且一直失败.但是,JUnit插件将作业标记为不稳定且未失败.

So I am using the Jenknis JUnit parser plugin to parse the test results. I have a job which has just one test and it fails all the time. However, the JUnit plugin marks the job as unstable and not failed.

任何原因吗?

我尝试将运行状况"报告放大系数设置为1、0.1、0.0,但是没有运气.似乎这就是为什么我的工作被报告为不稳定且未失败的原因.

I have tried to set the Health report amplification factor to 1, 0.1, 0.0 but no luck. Seems like somehow this is the reason why my job is reported as Unstable and not Failed.

如何使JUnit生成失败?

How can I get the JUnit to fail the build?

谢谢!

推荐答案

以下变通办法对我有效:

The following workaround worked for me:

sh "test ${currentBuild.currentResult} != UNSTABLE"

我在junit步骤之后添加了此内容.因此,最终您的管道类似于以下内容:

I added this right after the junit step. So in the end your pipeline looks similar to this:

stage('test') {
    steps {
        sh "mvn -Dmaven.test.failure.ignore=true -DtestFailureIgnore=true test"
    }
    post {
       success {
           junit '**/target/surefire-reports/**/*.xml'
           sh "test ${currentBuild.currentResult} != UNSTABLE"
       }
    }
}

这篇关于即使测试失败,Jenkins JUnit插件也将生成报告为不稳定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆