msbuildcontinuous-integrationresharpertfsbuilddotcover

dotCover not generating coverage for all assemblies


I've set up dotCover to run using an .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>

You can see (Service, Shared, UnitTests assemblies correctly included in the test coverage report (Shared, Service and UnitTest assemblies)

enter image description here

However, when running the same on the build server *Service and *Shared are missing.

enter image description here

After replacing Service.dll and Shared.dll and their "pdb's" from local copy to build server and running dotCover on build server again it works correctly.

This leads me to believe that build server runner does something different than msbuild.exe from VS when running build locally.

I found very similar issue description here: https://stackoverflow.com/questions/25855131/dotcover-and-xunit-not-gathering-coverage-statistics-in-some-environments, but not sure how to remedy this in my build server configuration.

enter image description here

Trace log output (one drive) https://1drv.ms/t/s!AtxuuqGHIqXwgTVqQJ_Y_-rGE8W9?e=HrZgj7


Solution

  • Found the solution: in my dotcover config xml I had to add: -noshadow switch, like so:

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

    Now all assemblies (except the ones I do want to filter) are showing up