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.
Any reasons why?
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.
How can I get the JUnit to fail the build?
Thanks!
The following workaround worked for me:
sh "test ${currentBuild.currentResult} != UNSTABLE"
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"
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With