Cruisecontrol doesn't know the details of what happened in the build, just if the build was reported by Ant (or other builder) as successful or unsuccessful. So if you want cruisecontrol to report a test failure as a build failure, you need to make Ant report the test failure as a failure.
There are at least two ways to approach that:
- use the haltonfailure attribute on junit
- use the failureproperty attribute on junit
Generally speaking if you want your build to fail after the first test fails you should use the haltonfailure attribute, while if you want to see all the test failures you should use the failureproperty attribute.
See the Ant manual for more details on the junit task the various attributes available: http://ant.apache.org/manual/OptionalTasks/junit.html
from Lance Titchkosky:
So in your junit task you'd have something like:
<junit fork="true" haltonfailure="false" failureproperty="junit_test_failed" printsummary="on">
...
</junit>
<fail if="junit_test_failed" message="One or more JUnit tests failed"/>
also see http://wiki.apache.org/ant/TheElementsOfAntStyle
Frequently Asked Questions