gpt4 book ai didi

java - Ant : Junit failure triggers a haltonfailure

转载 作者:行者123 更新时间:2023-11-29 03:45:53 24 4
gpt4 key购买 nike

我发现了以下内容:

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

不会过早停止(所有测试都会运行)。

然而......以下

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

将在第一个失败的测试后失败。请注意,在这种情况下,我通过 Assert.fail() 保证测试失败;

这个,我假设要么

1) Ant 将 ERROR 视为 FAILURE 的子类。或

2) Ant 感知失败的方式很奇怪——也就是说,当决定停止时,失败被(错误地)视为错误。

我的问题:为什么 ant 会在测试失败时停止(即使明确配置了 haltonfailure="no")。任何想法都可能很有启发性!谢谢。

更新

我现在意识到这显然是 ant http://ant.apache.org/manual/Tasks/junit.html 中涵盖的 RTFM 问题(请参阅下面的正确答案)。

最佳答案

引自junit ant任务documentation :

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

所以答案是:ant junit 将失败视为错误,因此停止构建

关于java - Ant : Junit failure triggers a haltonfailure,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10936140/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com