dotCover不会为所有程序集生成覆盖率

时间:2019-04-26 20:26:02

标签: msbuild continuous-integration resharper tfsbuild dotcover

我已将dotCover设置为使用.xml运行

<?xml version="1.0" encoding="utf-8"?>
<CoverageParams>
  <TargetExecutable>
    c:\dotcover\xunit\xunit.console.exe
  </TargetExecutable>
  <TargetArguments>
    "INWK.Configuration.UnitTests.dll"
  </TargetArguments>
  <TargetWorkingDir>
    ..\bin\x64\Debug\
  </TargetWorkingDir>
  <TempDir>
    <!-- Directory for auxiliary files. Set to the system temp by default. -->
  </TempDir>
  <Output>
    dotCover-xunit.dcvr
  </Output>
  <InheritConsole>
    <!-- [True|False] Lets the application being analyzed to inherit dotCover console. True by default. -->
  </InheritConsole>
</CoverageParams>

您可以看到(服务,共享,UnitTests程序集正确包含在测试覆盖率报告中(共享,Service和UnitTest程序集)

enter image description here

但是,当在构建服务器上运行* Service和* Shared时,缺少它们。

enter image description here

从本地副本替换Service.dll和Shared.dll及其“ pdb”到构建服务器并在构建服务器上再次运行dotCover后,它可以正常工作。

这使我相信,在本地运行构建时,构建服务器运行程序与VS的msbuild.exe有所不同。

我在这里发现了非常相似的问题描述:https://stackoverflow.com/questions/25855131/dotcover-and-xunit-not-gathering-coverage-statistics-in-some-环境,但不确定如何在我的构建服务器配置中对此进行补救。

enter image description here

跟踪日志输出(一个驱动器) https://1drv.ms/t/s!AtxuuqGHIqXwgTVqQJ_Y_-rGE8W9?e=HrZgj7

1 个答案:

答案 0 :(得分:2)

找到了解决方案: 在我的dotcover配置xml中,我必须添加:-noshadow开关,如下所示:

<CoverageParams>
  <TargetExecutable>
    c:\dotcover\xunit\xunit.console.exe
  </TargetExecutable>
  <TargetArguments>
    "INWK.OrderIndexing.UnitTests.dll" -noshadow
  </TargetArguments>
  <TargetWorkingDir>
    ..\bin\x64\Release\
  </TargetWorkingDir>
...

现在所有程序集(除了我要过滤的程序集都在显示)