如果其中一项蚂蚁测试失败,如何使 Jenkins 显示失败 [英] How to make Jenkins display fail if one of the ant tests fail
问题描述
无论彼此是否成功,我都应该执行几个测试,如果其中至少一个测试失败,我希望 Jenkins/Hudson 显示红灯.我当前的(为清晰起见而简化)配置如下:
I have several tests that should be executed regardless of each other's success and I want Jenkins/Hudson to display red light if at least one of those tests failed. My current (simplified for clarity) configuration is as following:
ci.sh:
...
ant
...
build.xml:
...
<target name="AllTests">
<antcall target="TestA"/>
<antcall target="TestB"/>
<antcall target="TestC"/>
</target>
<target name="TestA">
...
<exec executable="..." failonerror="false"/>
...
</target>
<target name="TestB">
...
<exec executable="..." failonerror="false"/>
...
</target>
<target name="TestC">
...
<exec executable="..." failonerror="false"/>
...
</target>
...
无论如何我怎样才能让所有测试都执行,但如果三个测试中至少有一个失败,ant/Jenkins 应该失败?
How can I make all the tests to execute anyways, but ant/Jenkins should fail if at least one of the three failed?
推荐答案
我发现将线程数设置为1"的 parallel
任务作为一种可行的解决方法.这并不完美,但 build.xml
中的变化很小:
I have found parallel
task with thread count set to "1" as a viable workaround. This isn't perfect, but the change in build.xml
is minimal:
build.xml:
...
<target name="AllTests">
<parallel threadCount="1" timeout="900000">
<antcall target="TestA"/>
<antcall target="TestB"/>
<antcall target="TestC"/>
</parallel>
</target>
<target name="TestA">
...
<exec executable="..." failonerror="false"/>
...
</target>
<target name="TestB">
...
<exec executable="..." failonerror="false"/>
...
</target>
<target name="TestC">
...
<exec executable="..." failonerror="false"/>
...
</target>
...
这篇关于如果其中一项蚂蚁测试失败,如何使 Jenkins 显示失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!