Ant : Junit 故障触发haltonfailure [英] Ant : Junit failure triggers a haltonfailure
问题描述
我发现以下内容:
<junit haltonfailure="no" haltonerror="no" >
<!-- some tests guaranteed to call Assert.fail(); -->
</junit>
不会过早停止(所有测试都将运行).
Will not prematurely halt (all tests will run).
然而......以下
<junit haltonfailure="no" haltonerror="yes" >
在 FIRST 测试失败后将失败.请注意,在这种情况下,我通过 Assert.fail() 保证测试失败;
Will fail after the FIRST failed test. Note that in this case, I'm guaranteeing that the test is failing via Assert.fail();
这个,我假设要么
1) Ant 将 ERROR 视为 FAILURE 的子类.或
1) Ant considers an ERROR to be a subclass of a FAILURE. or
2) 蚂蚁感知失败的方式很奇怪——也就是说,在决定停止时,失败被(错误地)视为错误.
2) There is a oddity in the way ant percieves failures - that is, failures are treated (erroneously) as errors when deciding to halt.
我的问题:为什么蚂蚁会在测试失败时停止(即使明确配置了haltonfailure="no").任何想法都可能非常有启发性!谢谢.
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.
更新
我现在意识到这显然是一个 RTFM 问题,在 ant http://ant.apache.org/manual/Tasks/junit.html(参见下面的正确答案).
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).
推荐答案
引自 junit ant task 文档:
Quote from junit ant task documentation:
haltonfailure:如果测试失败,则停止构建过程(错误也被视为失败).
haltonfailure: Stop the build process if a test fails (errors are considered failures as well).
所以答案是:ant junit 将失败视为错误,因此构建停止
So the answer is: ant junit considers failures as errors, hence the stop of the build
这篇关于Ant : Junit 故障触发haltonfailure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!