Skip to content

Publish Microsoft.Testing.Platform coverage messages from coverlet.MTP #2020

Description

@Evangelink

Context

coverlet.MTP currently generates coverage reports from its ITestHostProcessLifetimeHandler. Another MTP extension that needs those reports cannot safely use the same callback because registration order between independent extensions is not guaranteed. This is the race reported in microsoft/testfx#8904 for ReportGenerator.Mtp.

Microsoft.Testing.Platform has now merged a first-class coverage message and consumer model in microsoft/testfx#9896, planned for the currently unreleased MTP 2.4.0:

  • TestCoverageReportMessage publishes the path and format of a generated report.
  • TestCoverageMessage publishes covered/coverable counts by scope and metric.
  • TestCoverageThresholdMessage publishes threshold evaluations.
  • ITestCoverageResult exposes the correlated reports, measurements, and thresholds to consumers.
  • ITestCoverageCapabilities lets consumers detect enabled coverage producers.

Request

Once coverlet.MTP can target MTP 2.4.0, could it adopt these contracts?

At minimum, CollectorExtension could implement IDataProducer, advertise TestCoverageReportMessage in DataTypesProduced, and publish one message on IMessageBus after each on-disk coverage report is successfully written. Publishing TestCoverageMessage for Coverlet's summary metrics and TestCoverageThresholdMessage for its threshold results would also let MTP's built-in terminal and CI reporters consume Coverlet data consistently.

ReportGenerator.Mtp could then consume the report references through ITestCoverageResult during ITestSessionLifetimeHandler.OnTestSessionFinishingAsync (or consume TestCoverageReportMessage directly), removing the cross-extension lifetime-handler ordering dependency and file-glob polling.

Relevant design: RFC 019 — Code coverage messages & consumer model.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    driver-MTPIssue related to Microsoft Testing Platform driverenhancementGeneral enhancement request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions