【问题标题】:MSBuild Should not fail even if one specific NUnit test fail即使一个特定的 NUnit 测试失败,MSBuild 也不应该失败
【发布时间】:2012-06-05 14:30:23
【问题描述】:

我已将持续构建过程与 Cruise Control 集成在一起。在 EOD 时,它会生成一个构建报告。如果任何 NUnit 测试用例失败,则构建失败。我们编写了一个特定的测试用例并将其添加到单独的 dll 中。如果该程序集中的任何测试用例失败,我们不希望我们的构建失败。我们正在使用 MSBuild 目标、.proj 文件和巡航控制、ccnet 配置文件。

【问题讨论】:

    标签: msbuild nunit cruisecontrol.net


    【解决方案1】:

    我会调用 NUnit 两次:一次用于您希望构建失败的测试,如果没有通过,然后第二次运行您不希望影响构建的测试,例如,

    <!-- Any failing tests in Assembly1.dll will cause the build to fail. -->
    <Exec Command="nunit.exe Assembly1.dll" />
    
    <!-- Any failing tests in Assembly2.dll won't fail the build because the ContinueOnError attribute is set to True. -->
    <Exec Command="nunit.exe Assembly2.dll" ContinueOnError="True" />
    

    【讨论】:

    • 如果任何测试失败,则通过将 ContinueOnError 设置为 true 将执行该程序集中的剩余测试。但是 Build 仍然失败,因为我的测试失败了。所以 ContinueInError = true 不起作用
    猜你喜欢
    • 1970-01-01
    • 2016-06-23
    • 1970-01-01
    • 2017-10-31
    • 2018-12-17
    • 1970-01-01
    • 2017-08-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多