简体   繁体   中英

Fail ant build by checking junit report?

I need to cause my build to fail based only on the junit report. Is there a way to do this. I know how to fail the build using haltonfailure in junit tag, but in my build.xml I have access only to the junit report. I am using ant.

Try something like

    <fail if="testFail" message="At least one unit test failed"/>

in your unit test target.

Refer to this: http://ant.apache.org/manual/Tasks/junit.html ,

try using failureproperty="failed.unit.test.property" inside junit ant task & check if its set & fail when your run completes with :

<fail if="failed.unit.test.property" message="Unit tests failed with more custom msg to your test class/suite"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM