Skip to content

Migrate tests to xUnit 4 and MTP retry - #487

Merged
Sebastien Lebreton (sailro) merged 1 commit into
mainfrom
sailro-xunit4-mtp-retry
Aug 24, 2026
Merged

Migrate tests to xUnit 4 and MTP retry#487
Sebastien Lebreton (sailro) merged 1 commit into
mainfrom
sailro-xunit4-mtp-retry

Conversation

@sailro

@sailro Sebastien Lebreton (sailro) commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Migrate the analyzer test project to xUnit.net v3 4.0.0 and Microsoft.Testing.Platform (MTP) v2, and replace the legacy VSTest CI path with native MTP execution and retry support.

This change:

  • updates xunit.v3 and xunit.runner.visualstudio to 4.0.0
  • adds Microsoft.Testing.Extensions.Retry 2.3.3
  • configures the test project with UseMicrosoftTestingPlatformRunner
  • runs the built test assembly directly instead of invoking VSTest-mode dotnet test
  • enables up to three retries for failed tests
  • preserves the existing distinction between full main-branch runs and feature/PR runs that exclude ConsistencyTests
  • updates the README, CI documentation, and Copilot instructions with the new runner commands
  • opts CI out of Microsoft Testing Platform telemetry

This also unblocks the corresponding xUnit 4 migrations in VSTU and VSTUC, which consume this repository through the external\VSTUAnalyzers submodule.

CI behavior

The main branch runs the complete suite:

dotnet ./src/Microsoft.Unity.Analyzers.Tests/bin/Debug/net10.0/Microsoft.Unity.Analyzers.Tests.dll --retry-failed-tests 3

Feature and pull-request branches exclude the documentation-dependent consistency tests:

dotnet ./src/Microsoft.Unity.Analyzers.Tests/bin/Debug/net10.0/Microsoft.Unity.Analyzers.Tests.dll --retry-failed-tests 3 --filter-not-class Microsoft.Unity.Analyzers.Tests.ConsistencyTests

The generated xUnit 4 runner help was used to confirm the retry and exact-class filter syntax rather than relying on the previous VSTest filter format.

Validation

Validation was performed with .NET SDK 10.0.400:

  • built the complete solution successfully with no warnings or errors
  • ran the feature/PR command successfully: 472 tests passed
  • ran the full main-branch command successfully: 476 tests passed
  • confirmed through generated --help output that --retry-failed-tests and --filter-not-class are available
  • confirmed through generated --info output that Microsoft.Testing.Platform 2.3.3, the xUnit 4.0.0 provider, and Retry 2.3.3 are active

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@sailro
Sebastien Lebreton (sailro) requested a review from a team as a code owner August 24, 2026 15:22
@sailro
Sebastien Lebreton (sailro) merged commit 3d8db79 into main Aug 24, 2026
6 checks passed
@sailro
Sebastien Lebreton (sailro) deleted the sailro-xunit4-mtp-retry branch August 24, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants