Skip to content

Failure thresholds mtp - #2019

Merged
Bertk merged 12 commits into
coverlet-coverage:masterfrom
Bertk:failure-thresholds-mtp
Sep 9, 2026
Merged

Bertk merged 12 commits into
coverlet-coverage:masterfrom
Bertk:failure-thresholds-mtp

Conversation

@Bertk

@Bertk Bertk commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator
  • add support for failure thresholds
  • reuse implementation of coverlet.core (also used for coverlet.console, coverlet.msbuild)

@Bertk Bertk linked an issue Aug 30, 2026 that may be closed by this pull request
@Bertk Bertk added enhancement General enhancement request driver-MTP Issue related to Microsoft Testing Platform driver labels Aug 30, 2026
@Bertk Bertk linked an issue Aug 31, 2026 that may be closed by this pull request
@Bertk
Bertk requested a lite review from Copilot September 1, 2026 08:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds coverage failure-threshold support to the coverlet.MTP extension, aligning it with existing threshold behavior in other Coverlet drivers, and updates the MTP integration documentation and tests accordingly.

Changes:

  • Introduces threshold settings (Threshold, ThresholdType, ThresholdStat) in MTP settings/config parsing and exposes them via command-line options.
  • Adds threshold evaluation/output in the collector and sets a non-zero exit code when thresholds are not met.
  • Updates MTP docs and adds/extends unit tests around parsing/validation and threshold reporting.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
test/coverlet.MTP.tests/Configuration/CoverletMTPSettingsTests.cs Extends settings default/to-string tests for threshold fields.
test/coverlet.MTP.tests/Configuration/CoverletMTPSettingsParserTests.cs Adds config parsing test coverage for threshold settings.
test/coverlet.MTP.tests/CommandLine/CoverletMTPCommandLineTests.cs Adds validation tests for new threshold-related CLI options.
test/coverlet.MTP.tests/Collector/CollectorExtensionThresholdTests.cs New tests verifying threshold summary output formatting.
src/coverlet.MTP/Configuration/CoverletMTPSettingsParser.cs Parses threshold-related settings from configuration.
src/coverlet.MTP/Configuration/CoverletMTPSettings.cs Adds threshold fields to settings and includes them in ToString output.
src/coverlet.MTP/Configuration/CoverletMTPConstants.cs Adds config keys/defaults for threshold settings.
src/coverlet.MTP/Configuration/CoverletExtensionConfiguration.cs Adds threshold fields to collector configuration model.
src/coverlet.MTP/Configuration/CoverageConfiguration.cs Adds threshold getters that unify CLI vs config sources.
src/coverlet.MTP/CommandLine/CoverletOptionNames.cs Defines option names for threshold-related CLI options.
src/coverlet.MTP/CommandLine/CoverletExtensionCommandLineProvider.cs Validates threshold CLI arguments (range, enum values, coverage types).
src/coverlet.MTP/CommandLine/CoverletCommandLineOptionDefinitions.cs Registers threshold CLI options and their arities/descriptions.
src/coverlet.MTP/Collector/CollectorExtension.cs Implements threshold evaluation, reporting, and exit code behavior.
global.json Updates pinned .NET SDK version.
Documentation/DriversFeatures.md Updates feature matrix for MTP threshold support (and .NET Framework support).
Documentation/Coverlet.MTP.Integration.md Documents threshold CLI/config options and updates configuration tables.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/coverlet.MTP/Configuration/CoverletMTPSettings.cs Outdated
Comment thread src/coverlet.MTP/Configuration/CoverletMTPSettingsParser.cs
Comment thread src/coverlet.MTP/Configuration/CoverletMTPSettingsParser.cs Outdated
Comment thread src/coverlet.MTP/Configuration/CoverageConfiguration.cs
Comment thread src/coverlet.MTP/Configuration/CoverletExtensionConfiguration.cs
Comment thread test/coverlet.MTP.tests/CommandLine/CoverletMTPCommandLineTests.cs
Comment thread Documentation/Coverlet.MTP.Integration.md Outdated
Comment thread Documentation/Coverlet.MTP.Integration.md Outdated
Comment thread Documentation/Coverlet.MTP.Integration.md
Comment thread src/coverlet.MTP/Collector/CollectorExtension.cs Outdated
- Add CoverletCoverageDataProducer for MTP message creation/publishing
- CollectorExtension now publishes coverage, threshold, and report messages to IMessageBus
- Refactor exit code logic for threshold failures
- Update CollectorExtensionProvider for DI of message bus and producer
- Refactor and add tests for message-based reporting and producer logic
- Update integration test for new summary output
- Bump MicrosoftTestingPlatformVersion to 2.4.0
- Update .github/copilot-instructions.md for test/code standards and netstandard2.0 rules
The code now computes and reports method coverage alongside line and branch coverage. It introduces overall and per-module method coverage metrics using CoverageSummary.CalculateMethodCoverage, and includes these in the TestCoverageMessage output. Method coverage is now always calculated and reported, independent of threshold configuration.
@Bertk
Bertk marked this pull request as ready for review September 7, 2026 09:41
@Bertk
Bertk force-pushed the failure-thresholds-mtp branch 5 times, most recently from 0665186 to a4c5900 Compare September 8, 2026 15:30
@Bertk
Bertk force-pushed the failure-thresholds-mtp branch from 7613e5c to bf6f4cd Compare September 9, 2026 06:33
Update global.json SDK to 10.0.401 and introduce $(MicrosoftNetRuntimeVersion) property set to 10.0.12. Replace hardcoded Microsoft.Extensions.* and System.* package versions in project files with the new property. Bump Microsoft.CodeAnalysis to 5.9.0, Microsoft.NET.Test.Sdk to 18.9.0, and xunit.runner.visualstudio to 4.0.0. Update net9.0-specific dependencies in coverlet.core.csproj to 9.0.20 and System.Text.Json in coverlet.integration.template.csproj to 10.0.12. Align conditional references in coverlet.integration.tests.csproj to use the new runtime version property.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

It includes a functional bug in report-format publishing (cobertura/opencover are misidentified), plus documentation inconsistencies and missing unit tests for the new exit-code enforcement behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 41/41 changed files
  • Comments generated: 5
  • Review effort level: Lite

Comment thread src/coverlet.MTP/Collector/CollectorExtension.cs Outdated
Comment thread Documentation/Coverlet.MTP.Integration.md Outdated
Comment thread Documentation/Coverlet.MTP.Integration.md
Comment thread src/coverlet.MTP/Collector/CollectorExtension.cs Outdated
This was referenced Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

driver-MTP Issue related to Microsoft Testing Platform driver enhancement General enhancement request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish Microsoft.Testing.Platform coverage messages from coverlet.MTP Enhancement Request: Coverage Failure Thresholds in MTP

2 participants