Skip to content

Migrate tests to xUnit v3 and Microsoft.Testing.Platform - #6055

Merged
max-charlamb merged 10 commits into
dotnet:mainfrom
max-charlamb:xunit-v3-migration
Sep 23, 2026
Merged

max-charlamb merged 10 commits into
dotnet:mainfrom
max-charlamb:xunit-v3-migration

Conversation

@max-charlamb

@max-charlamb max-charlamb commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Summary

  • configure migrated test projects to use xUnit v3 and Microsoft.Testing.Platform
  • update test output helpers and dynamic skip handling for the xUnit v3 APIs
  • resolve test configuration files relative to the test output directory
  • remove the custom xUnit v2 skippable test infrastructure

Testing

  • Build.cmd passes
  • DotnetTrace.UnitTests: 108 passed, 36 skipped
  • Microsoft.Diagnostics.NETCore.Client.UnitTests: 146 passed, 18 skipped
  • full Test.cmd completed all migrated suites; local failures were limited to existing SOS source-line expectations and .NET 11 single-file DbgShim PE timestamp mismatches

Max Charlamb added 5 commits September 21, 2026 12:55
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Copilot AI lite review requested due to automatic review settings September 21, 2026 17:51
@max-charlamb
max-charlamb requested a review from a team as a code owner September 21, 2026 17:51

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.

Copilot review overview

🟡 Changes recommended

Critical skip behavior and concurrent output handling issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity · 1 Medium severity

Open (2)
What changed in this PR

This pull request migrates the test infrastructure from xUnit v2 to xUnit v3 and Microsoft.Testing.Platform, including skip handling, output helpers, cancellation, and project configuration.

Changes:

  • Configures test projects as xUnit v3/MTP executables.
  • Replaces custom skippable-test infrastructure.
  • Updates output helpers and cancellation-aware test execution.
  • Removes obsolete xUnit v2 dependencies.

Approval is blocked by conditional tests being unconditionally skipped, unsynchronized output buffers, and cancellation tokens captured during discovery.

File Description
src/​tests/​SOS.UnitTests/​xunit.runner.json Removes legacy runner configuration.
src/​tests/​SOS.UnitTests/​testconfig.json Adds xUnit v3 configuration.
src/​tests/​SOS.UnitTests/​SOSRunner.cs Updates skip APIs.
src/​tests/​SOS.UnitTests/​SOS.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​SOS.UnitTests/​SOS.cs Migrates theories and skips.
src/​tests/​Microsoft.SymbolStore.UnitTests/​Tracer.cs Updates xUnit output APIs.
src/​tests/​Microsoft.SymbolStore.UnitTests/​SymbolStoreTests.cs Removes obsolete xUnit imports.
src/​tests/​Microsoft.SymbolStore.UnitTests/​PEFileKeyGenerationTests.cs Removes obsolete xUnit imports.
src/​tests/​Microsoft.SymbolStore.UnitTests/​Microsoft.SymbolStore.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​Microsoft.SymbolStore.UnitTests/​KeyGeneratorTests.cs Removes obsolete xUnit imports.
src/​tests/​Microsoft.FileFormats.UnitTests/​Microsoft.FileFormats.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​ReversedServerTests.cs Migrates theories and skips.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​PidIpcEndpointTests.cs Migrates conditional skips.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​PerfMapTests.cs Migrates theories and skips.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​Microsoft.Diagnostics.NETCore.Client.UnitTests.csproj Enables xUnit v3 and removes v2 extensions.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​HandleableCollectionTests.cs Adds cancellation support.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​GetPublishedProcessesTests.cs Migrates theories.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​GetProcessInfoTests.cs Migrates theories and skips.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​GetProcessEnvironmentTests.cs Migrates theories and skips.
src/​tests/​Microsoft.Diagnostics.NETCore.Client/​EventPipeSessionTests.cs Migrates theories and cancellation.
src/​tests/​Microsoft.Diagnostics.Monitoring/​PipelineTests.cs Updates cancellation-aware APIs.
src/​tests/​Microsoft.Diagnostics.Monitoring/​Microsoft.Diagnostics.Monitoring.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​PipelineTestUtilities.cs Updates xUnit output APIs.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​Microsoft.Diagnostics.Monitoring.EventPipe.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​LogsPipelineUnitTests.cs Migrates theories.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​GlobMatcherTests.cs Removes obsolete xUnit imports.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​EventTracePipelineUnitTests.cs Migrates theories.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​EventLogsPipelineUnitTests.cs Migrates theories and cancellation.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​EventCounterTriggerTests.cs Migrates skip handling.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​EventCounterPipelineUnitTests.cs Migrates theories and skips.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​DistributedTracesPipelineUnitTests.cs Migrates theories.
src/​tests/​Microsoft.Diagnostics.Monitoring.EventPipe/​AspNetTriggerUnitTests.cs Removes obsolete xUnit imports.
src/​tests/​Microsoft.Diagnostics.ExtensionCommands.UnitTests/​Microsoft.Diagnostics.ExtensionCommands.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​Microsoft.Diagnostics.DebugServices.UnitTests/​RunTests.cs Updates output and skip handling.
src/​tests/​Microsoft.Diagnostics.DebugServices.UnitTests/​Microsoft.Diagnostics.DebugServices.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​Microsoft.Diagnostics.DebugServices.UnitTests/​DebugServicesTests.cs Migrates theories and skips.
src/​tests/​Microsoft.Diagnostics.DebugServices.UnitTests/​CommandServiceTests.cs Migrates theories.
src/​tests/​Microsoft.Diagnostics.DebugServices.UnitTests/​ClrmaTests.cs Migrates theories and skips.
src/​tests/​eventpipe/​ThreadPoolEvents.cs Removes obsolete xUnit imports.
src/​tests/​eventpipe/​providers.cs Removes obsolete xUnit imports.
src/​tests/​eventpipe/​MethodEvents.cs Removes obsolete xUnit imports.
src/​tests/​eventpipe/​LoaderEvents.cs Removes obsolete xUnit imports.
src/​tests/​eventpipe/​GCEvents.cs Removes obsolete xUnit imports.
src/​tests/​eventpipe/​EventPipe.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​eventpipe/​CustomEvents.cs Removes obsolete xUnit imports.
src/​tests/​eventpipe/​ContentionEvents.cs Removes obsolete xUnit imports.
src/​tests/​eventpipe/​common/​RemoteTestExecutorHelper.cs Updates xUnit output APIs.
src/​tests/​dotnet-trace/​DotnetTrace.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​dotnet-trace/​CollectLinuxCommandFunctionalTests.cs Adds cancellation-aware arguments.
src/​tests/​dotnet-trace/​CollectCommandFunctionalTests.cs Removes obsolete xUnit imports.
src/​tests/​dotnet-trace/​ChildProcessTests.cs Migrates theories and skips.
src/​tests/​dotnet-stack/​StackTests.cs Migrates theories.
src/​tests/​dotnet-stack/​DotnetStack.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​dotnet-counters/​DotnetCounters.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​dotnet-counters/​CounterMonitorPayloadTests.cs Migrates theories and skips.
src/​tests/​dotnet-counters/​ConsoleExporterTests.cs Removes obsolete xUnit imports.
src/​tests/​DbgShim.UnitTests/​DebuggeeInfo.cs Removes obsolete xUnit imports.
src/​tests/​DbgShim.UnitTests/​DbgShimTests.cs Migrates theories and skips.
src/​tests/​DbgShim.UnitTests/​DbgShim.UnitTests.csproj Enables xUnit v3/MTP.
src/​tests/​CommonTestRunner/​TestRunnerUtilities.cs Updates xUnit output APIs.
src/​tests/​CommonTestRunner/​TestRunner.cs Updates xUnit output APIs.
src/​tests/​Common/​MockConsole.cs Removes obsolete xUnit imports.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkipTestException.cs Removes obsolete skip exception.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkippableTheoryTestCase.cs Removes v2 theory infrastructure.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkippableTheoryDiscoverer.cs Removes v2 theory infrastructure.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkippableTheoryAttribute.cs Removes v2 theory infrastructure.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkippableFactTestCase.cs Removes v2 fact infrastructure.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkippableFactMessageBus.cs Removes v2 skip infrastructure.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkippableFactDiscoverer.cs Removes v2 fact infrastructure.
src/​Microsoft.Diagnostics.TestHelpers/​Xunit.Extensions/​SkippableFactAttribute.cs Removes v2 fact infrastructure.
src/​Microsoft.Diagnostics.TestHelpers/​TestStep.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​TestRunner.cs Extends output helper APIs.
src/​Microsoft.Diagnostics.TestHelpers/​TestOutputProcessLogger.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​TestConfiguration.cs Migrates skip handling.
src/​Microsoft.Diagnostics.TestHelpers/​SdkPrebuiltDebuggeeCompiler.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​RemoteExecutorHelper.cs Updates xUnit APIs.
src/​Microsoft.Diagnostics.TestHelpers/​ProcessRunner.cs Extends output helper APIs.
src/​Microsoft.Diagnostics.TestHelpers/​PrebuiltDebuggeeCompiler.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​MultiplexTestOutputHelper.cs Extends output helper APIs.
src/​Microsoft.Diagnostics.TestHelpers/​Microsoft.Diagnostics.TestHelpers.csproj Switches to xUnit v3 dependencies.
src/​Microsoft.Diagnostics.TestHelpers/​LoggingListener.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​IndentedTestOutputHelper.cs Extends output helper APIs.
src/​Microsoft.Diagnostics.TestHelpers/​FileTestOutputHelper.cs Adds captured output support.
src/​Microsoft.Diagnostics.TestHelpers/​DotNetBuildDebuggeeTestStep.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​DebuggeeCompiler.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​CsprojBuildDebuggeeTestStep.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​ConsoleTestOutputHelper.cs Adds captured output support.
src/​Microsoft.Diagnostics.TestHelpers/​ConditionalTestAttributes.cs Adds conditional xUnit v3 attributes.
src/​Microsoft.Diagnostics.TestHelpers/​BaseDebuggeeCompiler.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​AssertX.cs Updates xUnit output APIs.
src/​Microsoft.Diagnostics.TestHelpers/​AcquireDotNetTestStep.cs Updates xUnit output APIs.

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

@hoyosjs

hoyosjs commented Sep 21, 2026

Copy link
Copy Markdown
Member

Does this then take over #5949?

@hoyosjs

hoyosjs commented Sep 21, 2026

Copy link
Copy Markdown
Member

If it does - cherry pick the build script changes at least - there's also a couple others that make sense to port to avoid installing too many runtimes.

Max Charlamb and others added 5 commits September 21, 2026 14:14
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Co-authored-by: Juan Hoyos <[email protected]>

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
Limit xUnit result discovery to the primary reports in the active configuration directory so TRX attachment copies are not imported as additional test results.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 90d32376-768b-4f8c-a982-54247c372cf3
@max-charlamb
max-charlamb merged commit 77fafcf into dotnet:main Sep 23, 2026
23 checks passed
@max-charlamb
max-charlamb deleted the xunit-v3-migration branch September 23, 2026 17:18
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants