gpt4 book ai didi

java - 我如何在不停止 ant 的情况下构建 "fail"?

转载 作者:塔克拉玛干 更新时间:2023-11-01 22:00:31 26 4
gpt4 key购买 nike

您好:我有一个 ANT 构建失败,并在失败时停止。我希望构建(而不是在单个单元测试失败时停止),完成运行所有单元测试,以便我可以知道哪些单元测试通过/失败。

然后(当然),我希望构建最终失败,打印出失败测试的数量。

奇怪的是,“haltonfailure”似乎比“停止”构建更多:它实际上改变了 Jenkins 解释的成功/失败结果!

如果可能的话,我想在我的构建脚本中使用自定义的“失败”标签来明确这一点,例如:

    <fail message="Some test(s) failed !">
<condition>
<not>
<testFailures>0</testFailures>
</not>
</condition> </fail>

最佳答案

Junit 任务上的 failureproperty 属性和条件失败效果很好。即使测试失败,我也用它来生成 junit html 报告。

<junit failureproperty="junit.failed" haltonfailure="no">
<!--- stuff -->
</junit>
<!-- Generate junit reports, pmd, coverage, etc -->
<fail if="junit.failed" message="Failed tests"/>

关于java - 我如何在不停止 ant 的情况下构建 "fail"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8220859/

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