问题描述
我已经使用Jenkins为我的node js应用程序创建了CI管道.我的管道包括诸如构建,单元测试,集成测试,代码分析等工作.我想知道是否有可能使构建失败,例如,通过实施诸如z个测试失败或通过率< z%?我知道默认情况下,即使一个测试用例失败,构建也会失败.
I have used Jenkins to create a CI pipeline for my node js application. My pipeline includes jobs such as build,unit test,integration test,code analysis etc. I was wondering if it is possible to fail a build if for example by implementing threshold like z number of tests failed or pass rate < z% ? I know by default a build will fail if even one test case fails.
推荐答案
您的单元测试脚本将需要处理数学&确定失败的测试百分比足以使整个工作失败的逻辑.然后,您的单元测试脚本可以返回通过(零)或失败(其他任何结果),詹金斯将相应地标记构建.
Your unit test script will need to handle the math & logic to determine what percent of tests failing is bad enough to fail the whole job. Then your unit test script can return pass (zero) or fail (anything else) and Jenkins will mark the build accordingly.
这篇关于詹金斯的失败管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!