我想统计失败的测试,并在所有测试完成后仅失败一次。这些测试每晚由Jenkins运行,并在出现故障或错误时报告结果。问题是我甚至无法开始计数,因为这只有failureProperty和errorProperty可以是true或false,但是当它到达第一个失败或错误测试时,它会停止并失败。我没有找到与谷歌良好的解决方案,他们推荐我这些属性,但他们没有做我所需要的。ANT Jenkins单元测试 - 计数失败测试
这里是代码:
<junit printsummary="true" fork="yes" forkmode="once"
showoutput="false" haltonfailure="no" maxmemory="1024m"
errorProperty="test.failed" failureProperty="test.failed">
<classpath refid="junit.classpath" />
<batchtest fork="yes" todir="${junit.dir}/raw" >
<formatter type="xml" />
<fileset dir="${classes.dir}">
<include name="**/*Test.class" />
<exclude name="*ear*/**"/>
<exclude name="**/Base*.class" />
<exclude name="**/JNDI*.class" />
</fileset>
</batchtest>
</junit>
<fail message="At least one test failed or has errors, please check test results in Jenkins to see details!" if="test.failed" />
难道我错过了什么重要呢?看来haltonfailure =“no”参数在这种情况下不起作用。
如果你能帮助我,请提前致谢!
可能的重复[我如何让Ant JUnit任务运行所有测试,然后在任何测试失败时停止构建的其余部分](http://stackoverflow.com/questions/4038547/how-我可以拥有蚂蚁junit任务运行所有测试然后停止其余的这个BU) – Miquel 2013-02-08 14:24:55
我发现了什么问题。 _errorProperty =“test.failed”failureProperty =“test.failed”_与_fail_一起工作我有更多的单元测试,所以脚本只能存活第一个!我有点失明,但是这给了我一个想法。谢谢你们! – CsBalazsHungary 2013-02-08 14:33:09
为了记录,我做了一个全局变量,它是错误的,如果测试失败,我切换为真。然后,我运行所有单独的测试,并将其称为失败蚂蚁方法。 – CsBalazsHungary 2013-02-08 14:47:34