Skip to content

Not showing all code coverage with xUnit v3 and MTP #537

@LockTar

Description

@LockTar

Sample project for this issue can be found here:
https://github.com/[LockTar/XUnitV3CodeCoverageSample](https://github.com/LockTar/XUnitV3CodeCoverageSample)

I have a project that is using xUnit v3 in combination with Microsoft Test Platform (MTP).
The tests are running fine and Code Coverage is calculated using Microsoft code coverage.

The project is following the xUnit v3 Code Coverage with MTP documentation.
The most important things are:

  1. Add the following in the project file:
<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>
<UseMicrosoftTestingPlatformRunner>true</UseMicrosoftTestingPlatformRunner>
  1. Add the following package references:
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
<PackageReference Include="xunit.v3" Version="3.0.1" />

The problem is then that the FCC extension is not showing the Code Coverage result. Even running it multiple times.
When I add the extra 2 nuget packages Microsoft.NET.Test.Sdk and xunit.runner.visualstudio, the results are showing in the FCC extension.

<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
<PackageReference Include="xunit.v3" Version="3.0.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />

The documentation states clearly that these packages references are not needed when your IDE is supporting MTP. I have version 17.14.16 which is the latest of Visual Studio.
I also have RunMsCodeCoverage set to true. I haven't changed any setting of the FCC extension.

Is FCC than still using VSTest? I thought that the extension is using MTP. I quote the readme:

FCC supports the new Microsoft.Testing.Platform for MsTest, NUnit and xUnit.

I have created in the [sample project](https://github.com/[LockTar/XUnitV3CodeCoverageSample](https://github.com/LockTar/XUnitV3CodeCoverageSample) 3 test projects. Tests2 should be the correct configuration in the project file. That project is not showing the Code Coverage in FCC. The other 2 test projects (different configurations) do show up. In the sample project, the .runsettings file is currently disabled for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions