【问题标题】:Is the NUnit task of a MSBuild script supposed to cause the Task to fail if a test fails?如果测试失败,MSBuild 脚本的 NUnit 任务是否应该导致任务失败?
【发布时间】:2013-10-12 02:40:45
【问题描述】:

我有一个标准的 CruiseControl.Net 设置,它从 svn 中提取代码、构建、测试并生成测试结果。我有一个间歇性问题,构建报告成功(绿色),但测试结果显示 1 或 2 次失败。

手动运行任务步骤,仅运行 NUnit 步骤,成功但输出和测试结果显示测试失败。我已经尝试过 ContinueOnFailure true 和 false (它在其他选项上爆炸并指示只有 true 或 false 是我认为由于旧版本而假设的有效值)。

任务是否应该出错(错误!= 0)?还是在 ccnet.config 的合并测试结果步骤中导致的失败?

ccnet 是否依赖 NUnit 任务来指示构建失败?

谢谢。

【问题讨论】:

    标签: nunit cruisecontrol.net


    【解决方案1】:

    我的理解是(“default”)它只会生成test-results.xml,并放在“uber.xml”文件中显示结果。

    http://build.sharpdevelop.net/ccnet/doc/CCNET/Using%20CruiseControl.NET%20with%20NUnit.html

    并且它可以被以下内容覆盖:

    <!-- Acceptance Test Assembly -->
    <exec program="nunit-console.exe" failonerror="false" resultproperty="testresult.acceptancetestassembly">
        <arg value="AcceptanceTestAssembly.dll" />
        <arg value="/xml=AcceptanceTestAssembly-Results.xml" />
    </exec>
    
    
    
    <!-- Check the results and fail if necessary -->
    <fail message="Failures reported in unit tests." unless="${int::parse(testresult.unittestassembly)==0}" />
    <fail message="Failures reported in acceptance tests." unless="${int::parse(testresult.acceptancetestassembly)==0}" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-05-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多