Ant : Junit failure triggers a haltonfailure

2019-07-26 21:20发布

问题:

I have found that the following :

<junit haltonfailure="no" haltonerror="no" >
   <!-- some tests guaranteed to call Assert.fail(); --> 
</junit>

Will not prematurely halt (all tests will run).

HOWEVER ...... The following

<junit haltonfailure="no" haltonerror="yes" >

Will fail after the FIRST failed test. Note that in this case, I'm guaranteeing that the test is failing via Assert.fail();

This, I am assuming that either

1) Ant considers an ERROR to be a subclass of a FAILURE. or

2) There is a oddity in the way ant percieves failures - that is, failures are treated (erroneously) as errors when deciding to halt.

My Question : Why would ant would halt on a test failure (even when explicitly configured with haltonfailure="no"). Any thoughts could be very enlightening ! Thanks.

UPDATE

I now realize that this is clearly an RTFM question which is covered in the ant http://ant.apache.org/manual/Tasks/junit.html (see correct answer below).

回答1:

Quote from junit ant task documentation:

haltonfailure: Stop the build process if a test fails (errors are considered failures as well).

So the answer is: ant junit considers failures as errors, hence the stop of the build



标签: java ant junit