简体   繁体   English

可能有一个詹金斯构建失败测试,​​但不会使整个构建失败?

[英]Possible to have a jenkins build fail tests but not fail the entire build?

I have Jenkins job that builds an apk. 我有建立Apk的Jenkins工作。 I also have a gradle command that will run some tests on an Android device. 我也有一个gradle命令,它将在Android设备上运行一些测试。 I would like my jenkins job to be able to run this gradle command, but if the tests fail I don't want jenkins to fail the entire build. 我希望我的jenkins作业能够运行gradle命令,但是如果测试失败,我不希望jenkins导致整个构建失败。 I just want it to mark the tests as failing and then notify people that the tests have failed. 我只希望它将测试标记为失败,然后通知人们测试已失败。 But failing tests by themselves should not mark the whole build as a fail. 但是,单独失败的测试不应将整个构建标记为失败。 Is there a way to do this? 有没有办法做到这一点?

I believe you use the ignoreFailures = true flag in your gradle.build's Test task config. 我相信您在gradle.build的Test任务配置中使用了ignoreFailures = true标志。

If that doesn't work, you can use Jenkins try/catch/finally: 如果这不起作用,则可以使用Jenkins try / catch / finally:

try {
    // test step here
} catch (error) {
    // other steps if test step fails
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM