【问题标题】:MSTest not being executed when run by Cruisecontrol schedule由 Cruisecontrol 计划运行时未执行 MSTest
【发布时间】:2010-10-04 11:32:45
【问题描述】:

一些背景:我试图在我当前的项目(.Net 4.0 和 VS 2010)上实现 Cruisecontrol (2.8.4)、MSBuild 和 MSTest 的集成。我正在使用 MSBuild 构建我的解决方案,并将一个 MSTest 作为 AfterBuild Target 添加到我的 .csproj 文件中以运行我的单元测试:

<Target Name="AfterBuild" DependsOnTargets="GetTestAssemblies" >
<Message Text="Normal Test" />
<Exec Command="del $(MSTestResultsFile)" ContinueOnError="true" />
<Exec WorkingDirectory="$(WorkingDir)" Command="MsTest @(TestAssemblies->'%(TestContainerPrefix)%(FullPath)',' ') /noisolation /resultsfile:$(MSTestResultsFile)" />
<Message Text="Normal Test Done" />

我已将 Cruisecontrol.config 配置为使用 MSBuild,即:

<schedule interval="300">
    <exec command="cmd.exe"
            workingdir="C:\CruiseControl\projects\Framework"
            args="msbuild Solution.sln" />
</schedule>

当我从命令提示符运行构建时,即:cmd.exe:

msbuild <projectname>.sln

,解决方案和项目正确构建,单元测试运行并将结果输出到指定的/resultsfile:$(MSTestResultsFile)

我的问题是当执行巡航控制计划中的命令时,构建(MSBuild)实际上成功但我的 MSTest:/resultsfile:$(MSTestResultsFile) 是空的。似乎根本没有运行单元测试。

我不知道为什么会这样? 任何帮助将不胜感激!

【问题讨论】:

    标签: msbuild mstest cruisecontrol


    【解决方案1】:

    通过更改 Cruisecontrol 计划配置以使用 msbuild.exe 而不是 cmd.exe 导致单元测试正在执行

    <schedule interval="300">
        <exec command="msbuild.exe"
                        workingdir="C:\Windows\Microsoft.NET\Framework\v4.0.30319"
                        args="C:\CruiseControl\projects\DTSFramework\DTS.Solution.sln" />
    </schedule>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-29
      • 1970-01-01
      • 1970-01-01
      • 2019-04-13
      • 1970-01-01
      相关资源
      最近更新 更多