dotCover不为所有程序集生成coverage

问题描述 投票:2回答:1

我已经设置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程序集正确包含在测试覆盖率报告中(Shared,Service和UnitTest程序集)

enter image description here

但是,在构建服务器上运行相同时*服务和*共享丢失。

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-environments,但不确定如何在我的构建服务器配置中解决这个问题。

enter image description here

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

msbuild continuous-integration resharper tfsbuild dotcover
1个回答
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>
...

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

© www.soinside.com 2019 - 2024. All rights reserved.