How do I get branch coverage with non-coverlet coverage?

Viewed 8

Since, at the moment of writing, there is an issue with an incorrect branch coverage being shown in a specific case by Coverlet, I decided to try to collect coverage with Microsoft's coverage collector instead. I have a test.runsettings file:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="Code Coverage" uri="datacollector://Microsoft/CodeCoverage/2.0" assemblyQualifiedName="Microsoft.VisualStudio.Coverage.DynamicCoverageDataCollector, Microsoft.VisualStudio.TraceCollector, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
          <Configuration>
          <CodeCoverage>
            <ModulePaths>
              <Include>
                <ModulePath>Example.dll</ModulePath>
              </Include>
            </ModulePaths>
          </CodeCoverage>
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
</RunSettings>

that I use like this:

dotnet test --results-directory t --settings:test.runsettings

Then the binary coverage file is converted to an XML report like this:

CodeCoverage.exe analyze /output:c.xml "[...]\example.coverage"

and the final HTML report is generated like this:

reportgenerator -reports:c.xml -targetdir:"report" -reporttypes:Html

The final report—as well as, it seems, the c.xml file—contain only line coverage, and no indications about branch coverage.

How do I get branch coverage as well?

0 Answers
Related