Skip to content

Conversation

@Tyrrrz
Copy link
Owner

@Tyrrrz Tyrrrz commented Oct 11, 2025

Closes #41

Based on #43 by @Evangelink

Copilot AI review requested due to automatic review settings October 11, 2025 18:43
@Tyrrrz Tyrrrz added the enhancement New feature or request label Oct 11, 2025
@Tyrrrz Tyrrrz marked this pull request as draft October 11, 2025 18:43
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Migrates the logger from VSTest to Microsoft.Testing.Platform, replacing the VSTest logger with a Testing Platform extension that reports to GitHub Actions.

  • Introduces a TestReporter extension (data consumer and session lifetime handler) with command-line options.
  • Updates summary/annotation generation and internal models (TestOutcome, TestResult, TestDefinition), removing VSTest-specific code.
  • Adjusts the template and statistics to align with the new outcome model.

Reviewed Changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
GitHubActionsTestLogger/Utils/Extensions/TestRunCriteriaExtensions.cs Removed VSTest-specific test run settings parsing.
GitHubActionsTestLogger/Utils/Extensions/TestResultExtensions.cs Removed VSTest-specific source info parsing and stack frame logic.
GitHubActionsTestLogger/Utils/Extensions/TestCaseExtensions.cs Removed VSTest-specific name parsing helpers.
GitHubActionsTestLogger/Utils/Extensions/TestPlatformExtensions.cs Adds helper to read single CLI option arguments from Microsoft.Testing.Platform.
GitHubActionsTestLogger/TestingPlatformBuilderHook.cs Adds Testing Platform builder hook to register GitHub reporting.
GitHubActionsTestLogger/TestSummaryTemplate.cshtml Switches to new TestOutcome enum (uses None vs NotFound) and cleans up imports.
GitHubActionsTestLogger/TestRunStatistics.cs Aligns overall outcome with new enum (removes NotFound branch).
GitHubActionsTestLogger/TestResult.cs New internal model for test results.
GitHubActionsTestLogger/TestReporterOptionsProvider.cs Defines CLI options and validation for the new reporter.
GitHubActionsTestLogger/TestReporterOptions.cs New options for reporter and resolver from CLI.
GitHubActionsTestLogger/TestReporterExtension.cs Extension metadata and enablement.
GitHubActionsTestLogger/TestReporterContext.cs Core context for formatting annotations and writing the summary.
GitHubActionsTestLogger/TestReporter.cs Implements IDataConsumer and ITestSessionLifetimeHandler to report results.
GitHubActionsTestLogger/TestOutcome.cs New internal TestOutcome enum and mapping from Testing Platform states.
GitHubActionsTestLogger/TestLoggerOptions.cs Removed old VSTest logger options.
GitHubActionsTestLogger/TestLoggerContext.cs Removed old VSTest logger context.
GitHubActionsTestLogger/TestLogger.cs Removed old VSTest logger.
GitHubActionsTestLogger/TestDefinition.cs New internal model for test definitions and metadata.
GitHubActionsTestLogger/GitHubWorkflow.cs Class made internal; used by reporter/summary.
GitHubActionsTestLogger/GitHubReportExtensions.cs Registers reporter and options provider in the TestApplicationBuilder.
GitHubActionsTestLogger/GitHubActionsTestLogger.csproj Replaces VSTest package with Microsoft.Testing.Platform.
GitHubActionsTestLogger.Tests/* Updates tests to use TestReporterContext and TestReporterOptions.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Tyrrrz Tyrrrz changed the title Migrate from vstest to Microsoft.Testing.Platform (#43) Migrate from vstest to Microsoft.Testing.Platform Oct 11, 2025
@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

❌ Patch coverage is 52.50501% with 237 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.71%. Comparing base (747e743) to head (af06bef).

Files with missing lines Patch % Lines
...itHubActionsTestLogger/MtpLoggerOptionsProvider.cs 0.00% 88 Missing ⚠️
GitHubActionsTestLogger/MtpLogger.cs 0.00% 85 Missing ⚠️
GitHubActionsTestLogger/MtpIntegration.cs 0.00% 15 Missing ⚠️
...ctionsTestLogger/Utils/Extensions/MtpExtensions.cs 0.00% 13 Missing ⚠️
GitHubActionsTestLogger/VsTestLogger.cs 88.42% 5 Missing and 6 partials ⚠️
...onsTestLogger/Utils/Extensions/VsTestExtensions.cs 72.72% 2 Missing and 4 partials ⚠️
...itHubActionsTestLogger/GitHub/GitHubEnvironment.cs 85.71% 2 Missing and 3 partials ⚠️
GitHubActionsTestLogger/GitHub/GitHubWorkflow.cs 87.09% 1 Missing and 3 partials ⚠️
...ctionsTestLogger/Reporting/TestReportingContext.cs 96.07% 0 Missing and 2 partials ⚠️
...itHubActionsTestLogger/Reporting/TestRunEndInfo.cs 84.61% 0 Missing and 2 partials ⚠️
... and 4 more
Additional details and impacted files
@@             Coverage Diff             @@
##           master      #53       +/-   ##
===========================================
- Coverage   84.85%   61.71%   -23.15%     
===========================================
  Files          16       23        +7     
  Lines         449      700      +251     
  Branches       57       78       +21     
===========================================
+ Hits          381      432       +51     
- Misses         40      237      +197     
- Partials       28       31        +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 15, 2025

@Evangelink how do I enable a custom extension when using MTP with xUnit v3? xUnit appears to generate its own Main(...) method, so it looks like I can't simply add a Program.cs to configure my extension. At the same time, it looks like the self-registration hook doesn't get picked up. Maybe I messed something up?

Here's the test project file:

https://github.com/Tyrrrz/GitHubActionsTestLogger/blob/mtp/GitHubActionsTestLogger.Demo.Mtp/GitHubActionsTestLogger.Demo.Mtp.csproj

Here's the hook code:

https://github.com/Tyrrrz/GitHubActionsTestLogger/blob/mtp/GitHubActionsTestLogger/TestingPlatformBuilderHook.cs

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 22, 2025

Got it working

@Tyrrrz Tyrrrz changed the title Migrate from vstest to Microsoft.Testing.Platform Add support for Microsoft.Testing.Platform Oct 22, 2025
@Evangelink
Copy link

FYI, MTP is now on 2.0.1. I don't know if you want to target only latest or not.

@Tyrrrz
Copy link
Owner Author

Tyrrrz commented Oct 28, 2025

FYI, MTP is now on 2.0.1. I don't know if you want to target only latest or not.

@Evangelink what's the recommended support policy? Target the earliest version of MTP that provides the features I need? Or always target latest?

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate from vstest to Microsoft.Testing.Platform

3 participants