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