Fail? Or Unstable?
By default, when a Jenkins runs your tests (via ANT) and tests fail, your build will not be marked as "Failed" but as "Unstable". If this is not what you want -- if you want failed tests to cause a build failure -- you need only make a small modification to your ANT build.
How to fail a build for failing tests
- add a "failureproperty" attribute to your mxunit task
- add a "fail" directive if failure property existsHere's what it looks like, in code. This all happens in your "runTests" target
Why this works
This works because the failure property will only be set if there are failures. If no failures occur, the property remains unset.
The fail directive's "if" test will return true only if the property exists -- it does not matter whether it's a boolean, whether it's true, etc. I simply need exist. Consequently, fail will only run if the failureproperty is set due to failed tests
|
|
Navigate space
|