Table of Contents

CoverletExtensionProvider Class

Definition

Namespace
Coverlet.MTP
Assemblies
coverlet.MTP.dll
Source
src/coverlet.MTP/CoverletExtensionProvider.cs

Registers controller instrumentation, test-host coverage flushing and coverage command-line options with MTP.

public static class CoverletExtensionProvider
Inheritance
CoverletExtensionProvider

Examples

Register the complete Coverlet extension on a custom MTP builder before adding your test framework and building the application. The returned builder has controller instrumentation, host flushing and coverage command-line support registered. Use this only when package-generated discovery has not already registered Coverlet; the usual package workflow needs no manual call.

using System.Threading.Tasks;
using Coverlet.MTP;
using Microsoft.Testing.Platform.Builder;

namespace CoverageTools.TestRunner;

public static class CoverageApplicationBuilder
{
    public static async Task<ITestApplicationBuilder> CreateAsync(string[] args)
    {
        ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(args);
        builder.AddCoverletExtensionProvider();
        return builder;
    }
}

Methods

Name Description
AddCoverletExtensionProvider(ITestApplicationBuilder, bool)

Adds the complete Coverlet coverage integration to a custom test application builder.