【问题标题】:Using TeamCity 9.1.3, how to call dotCover from nunitlauncher with parameters?使用 TeamCity 9.1.3,如何使用参数从 nunitlauncher 调用 dotCover?
【发布时间】:2015-09-28 20:04:17
【问题描述】:

我已经设置了一个包含多个目标的 MSBuild 文件。

在我正在调用的目标之一中

<Exec Command="$(teamcity_dotnet_nunitlauncher) v4.0 X86 NUnit-2.5.9 @(UnitTestDlls)"/>

其中 @(UnitTestDlls) 是一组包含我要进行单元测试的 DLL 的项目。我这样做是因为从 Web 界面我无法动态构建 DLL 列表以进行单元测试。

无论如何,这工作正常,但现在我想用 DotCover 添加覆盖率分析。

过去我们使用 PartCover 如下:

<Exec Command="$(teamcity_dotnet_nunitlauncher) v4.0 X86 NUnit-2.5.9 @(UnitTestDlls) 
               /partcover:%22$(PartCoverConsole)%22 /partcover-arguments:%22--register 
               --output $(PartCoverXmlOutputFile) --include [*]* --exclude [Accessibility]* 
               --exclude [*]Microsoft* --exclude [*test*]* --exclude [*Test*]* --exclude [*JetBrains*]*
               --exclude [*nunit*]* --exclude [*log4net*]*
               @(ExternalLibraries-&gt;'--exclude [%(Filename)]* ','')%22"/>

而且效果很好。

我尝试将 /partcover 参数更改为 /dotcover,但启动器似乎不支持 dotcover 参数!

【问题讨论】:

    标签: msbuild nunit teamcity dotcover


    【解决方案1】:

    您应该将 dotCover.exe 指定为可执行文件,并将 NUnitLauncher 作为目标可执行参数传递给 dotCover。

    <Exec Command="[path_to_dotCover]\dotCover.exe cover /TargetExecutable=&quot;$(teamcity_dotnet_nunitlauncher)&quot; /TargetArguments=&quot;v4.0 X64 NUnit-2.5.9 @(UnitTestDlls)&quot; /Output=&quot;[path_to_workdir]\[snapshot_name].dcvr&quot;" WorkingDirectory="[path_to_workdir]"/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-23
      • 1970-01-01
      • 2011-10-29
      • 1970-01-01
      • 2012-03-04
      • 1970-01-01
      • 1970-01-01
      • 2018-03-11
      相关资源
      最近更新 更多