This guy seems to have the same problem。如何让xunit停止jenkins管道失败?
下面是我在做什么:
stage('Test') {
steps {
bat "\"${tool 'VSTestRunner'}\" %WORKSPACE%\\MyApp\\bin\\Debug\\MyApp.dll /logger:trx & exit 0"
// The test publish is responsible for decided whether the test stage failed
step([$class : 'XUnitPublisher',
testTimeMargin: '3000',
thresholdMode: 1,
thresholds: [
[$class: 'FailedThreshold', failureNewThreshold: '', failureThreshold: '1', unstableNewThreshold: '', unstableThreshold: ''],
[$class: 'SkippedThreshold', failureNewThreshold: '', failureThreshold: '', unstableNewThreshold: '', unstableThreshold: '']
],
tools : [[$class: 'MSTestJunitHudsonTestType',
deleteOutputFiles: true,
failIfNotNew: false,
pattern: "TestResults\\*.trx",
skipNoTestFiles: false,
stopProcessingIfError: true
]]
])
}
}
如果测试失败管道仍在继续。
我希望能够通过xunit设置来控制管道是否继续。有没有比这更优雅的方式:
if (currentBuild.result.equals("FAILURE")) {
throw "Test results did not pass thresholds"
}
此外,“stopProcessingIfError”是做什么的?我认为如果超过了错误阈值,它会停止管道,但事实并非如此。 xunit服务有没有这样做的参数?
通常,如果你想失败一个构建,你必须抛出退出状态!= 0 – OK999
我有什么错误级别可用于我?只是失败,成功和不稳定? – red888