小编典典

如果其中一项蚂蚁测试失败,如何使Jenkins显示失败

jenkins

无论彼此是否成功,我都应该执行几个测试,并且如果这些测试中至少有一个失败,我希望詹金斯/哈德森显示 红灯 。我当前的配置(为简化起见)如下:

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应该会失败?


阅读 266

收藏
2020-07-25

共1个答案

小编典典

我发现parallel线程计数设置为“ 1”的任务是可行的解决方法。这不是完美的,但是更改build.xml很小:

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>
...
2020-07-25