【问题标题】:Fail ant build by checking junit report?通过检查junit报告使ant build失败?
【发布时间】:2014-05-23 06:04:05
【问题描述】:

我需要仅根据 junit 报告导致我的构建失败。有没有办法做到这一点。我知道如何在 junit 标记中使用haltonfailure 使构建失败,但在我的 build.xml 中,我只能访问 junit 报告。我正在使用蚂蚁。

【问题讨论】:

    标签: java ant junit build junit4


    【解决方案1】:

    试试类似的东西

        <fail if="testFail" message="At least one unit test failed"/>
    

    在您的单元测试目标中。

    【讨论】:

      【解决方案2】:

      参考这个:http://ant.apache.org/manual/Tasks/junit.html

      尝试在 junit ant 任务中使用 failureproperty="failed.unit.test.property" 并在运行完成时检查它是否设置并失败:

      <fail if="failed.unit.test.property" message="Unit tests failed with more custom msg to your test class/suite"/>
      

      【讨论】:

        猜你喜欢
        • 2011-10-06
        • 2013-06-25
        • 1970-01-01
        • 1970-01-01
        • 2014-10-11
        • 2012-10-08
        • 1970-01-01
        • 1970-01-01
        • 2016-06-12
        相关资源
        最近更新 更多