我们在使用 CruiseControl.Net 1.5.7256.1 时遇到问题。当我们的构建实际上失败时,它们却显示出成功。我们强制构建,它运行单元测试,一些单元测试失败,但它显示成功。我们使用 exec 任务来执行 ant 脚本。这是执行测试的目标:
<target name="test" depends="build" description="unit test" >
<copy file="configuration_notag.txt" tofile="${build.dir}\configuration.txt"/>
<junit errorProperty="test.failed" failureProperty="test.failed">
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<classpath refid="classpath" />
<test name="${test1.class}" />
<test name="${test2.class}" />
</junit>
<fail message="Tests failed: check test reports." if="test.failed" />
</target>
这是构建文件中的输出:
错误:(4) [junit] 测试 TestNoTag 失败 构建失败 C:\sandbox\idblue\idblue\trunk\Unit_Test\IDBlueJavaWindowsUnitTest\build_notag.xml:43:测试失败:检查测试报告。 总时间:2分37秒
既然 ant 失败并返回失败错误代码,为什么 Cruisecontrol 没有发现它?我们的 ccnet.config 文件中没有什么需要注意的,它只是使用正确的构建文件调用 ant。 CruiseControl.Net 1.4.2 没有出现此问题。还有其他人遇到过这个问题吗?谷歌搜索了这个问题,但一无所获。
最佳答案
我弄清楚了问题所在,我需要将其添加到 ant.bat 的最后一行:
退出%ERRORLEVEL%
这将退出代码保留回 CruiseControl,构建最终开始正常失败。
关于CruiseControl.net 1.5.7256.1 : my build fails but the dashboard shows success,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3805986/