Analyze coverage of Testing Platform tests
Test frameworks that use Microsoft.Testing.Platform, such as TUnit, run tests inside the test process. To attribute coverage data to individual tests, dotCover needs to know when each test starts and finishes in that process. The JetBrains.dotCover.Framework NuGet package reports these test boundaries to dotCover.
Add this package to every Testing Platform test project whose coverage you want to analyze.
Test projects that use VSTest do not need this package.
Add the dotCover package to a test project
Add the package to your test project:
dotnet add package JetBrains.dotCover.FrameworkIf your test project uses the generated entry point, no code changes are required.
If you set the
GenerateTestingPlatformEntryPointMSBuild property tofalseand provide your ownMainmethod, register the extension manually:JetBrains.dotCover.Framework.TestingPlatformBuilderHook.AddExtensions(testApplicationBuilder, args);Run coverage analysis of unit tests as usual. The Unit Test Coverage window now shows coverage per test, and you can navigate to covering tests.
Requirements
A target framework compatible with .NET Standard 2.0
Microsoft.Testing.Platform 2.3.0 or later. The extension registers automatically through the MSBuild integration of the platform, which test frameworks built on the platform use by default.
Limitations
dotCover disables parallel test execution during a coverage run to keep per-test data accurate. You do not need to change the parallelism settings of your test framework. A coverage run can therefore take longer than a run without coverage analysis.