如何在不停止蚂蚁的情况下"失败"构建?

jay*_*100 3 java ant build

嗨:我有一个失败的ANT版本,并且在失败时停止.我想要构建(而不是在单个单元测试失败时暂停),完成所有单元测试,以便我可以知道哪些通过/失败.

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

奇怪的是,看起来"haltonfailure",更多的是"停止"构建:它实际上改变了Jenkins所解释的成功/失败结果!

我希望,如果可能的话,使用自定义的"fail"标记在我的构建脚本中明确这一点,即:

    <fail message="Some test(s) failed !">
      <condition>
         <not>
          <testFailures>0</testFailures>
         </not>
      </condition>  </fail>
Run Code Online (Sandbox Code Playgroud)

Nia*_*rva 9

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"/>
Run Code Online (Sandbox Code Playgroud)