Skip to content

Migrate tests to xUnit v3 with Microsoft.Testing.Platform#5361

Closed
Copilot wants to merge 8 commits intomainfrom
copilot/update-tests-to-microsoft-testing-platform
Closed

Migrate tests to xUnit v3 with Microsoft.Testing.Platform#5361
Copilot wants to merge 8 commits intomainfrom
copilot/update-tests-to-microsoft-testing-platform

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 30, 2026

Description

Migrates test infrastructure from xUnit v2 to xUnit v3 with Microsoft.Testing.Platform (MTP) for modern test execution and built-in retry support.

Package changes:

  • xunit 2.9.3 → xunit.v3 3.2.2
  • Removed: xunit.assert, xunit.extensibility.core, xunit.runner.visualstudio, Microsoft.NET.Test.Sdk, Xunit.SkippableFact
  • Added: xunit.v3.extensibility.core, Microsoft.Testing.Extensions.Retry

Build configuration:

  • Test projects build as executables (OutputType=Exe) for MTP
  • Enabled UseMicrosoftTestingPlatformRunner=true

Retry mechanism:

  • Removed v2 extensibility code (CustomXunitTestFramework, discoverers, RetryTestCase)
  • RetryFact/RetryTheory retained as markers; actual retries via MTP: dotnet test -- --retry-failed-tests 3

Xunit.SkippableFact migration:

  • Created SkipCompatibility.cs providing Skip.If()/Skip.IfNot() using xUnit v3's Assert.Skip()
  • Converted all [SkippableFact][Fact]

Related issues

User request for Microsoft.Testing.Platform migration with built-in retry support.

Testing

  • Microsoft.Health.Extensions.Xunit builds successfully for net8.0/net9.0
  • Full solution build requires CI environment with private NuGet feed access

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • When changing or adding behavior, if your code modifies the system design or changes design assumptions, please create and include an ADR.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • microsofthealthoss.pkgs.visualstudio.com
    • Triggering command: /usr/bin/dotnet dotnet restore --ignore-failed-sources (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build src/Microsoft.Health.Extensions.Xunit/Microsoft.Health.Extensions.Xunit.csproj --no-restore -p:TreatWarningsAsErrors=false (dns block)
    • Triggering command: /usr/bin/dotnet dotnet build src/Microsoft.Health.Extensions.Xunit/Microsoft.Health.Extensions.Xunit.csproj --no-restore -p:TreatWarningsAsErrors=false -p:WarningsAsErrors= (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 4 commits January 30, 2026 01:50
Co-authored-by: mikaelweave <753437+mikaelweave@users.noreply.github.com>
…attributes

Co-authored-by: mikaelweave <753437+mikaelweave@users.noreply.github.com>
Co-authored-by: mikaelweave <753437+mikaelweave@users.noreply.github.com>
Co-authored-by: mikaelweave <753437+mikaelweave@users.noreply.github.com>
Copilot AI changed the title [WIP] Update all tests to use Microsoft.Testing.Platform with built in retries Migrate tests to xUnit v3 with Microsoft.Testing.Platform Jan 30, 2026
Copilot AI requested a review from mikaelweave January 30, 2026 02:09
@mikaelweave
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mikaelweave
Copy link
Copy Markdown
Contributor

@copilot You can see some errors from #file:91.txt during the build pipelines

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 30, 2026

@copilot You can see some errors from #file:91.txt during the build pipelines

I don't have direct access to the Azure DevOps pipeline logs or the #file:91.txt file you mentioned. Could you please share the specific error messages from the build? You can either:

  1. Paste the relevant error lines directly in a comment
  2. Provide the Azure DevOps build link so I can try to retrieve the logs

This will help me identify and fix the build issues.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • microsofthealthoss.pkgs.visualstudio.com
    • Triggering command: /usr/bin/dotnet dotnet restore --ignore-failed-sources -p:TreatWarningsAsErrors=false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

… Assert.Skip

Co-authored-by: mikaelweave <753437+mikaelweave@users.noreply.github.com>
@mikaelweave
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mikaelweave
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Co-Authored-By: Warp <agent@warp.dev>
@mikaelweave
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

…interface

- Updated test classes to replace ITestOutputHelper with Xunit.ITestOutputHelper for consistency.
- Refactored test classes to implement the new IAsyncLifetime interface for async initialization and disposal.
- Introduced compatibility shims for IAsyncLifetime and ITestOutputHelper to maintain backward compatibility with existing tests.
- Added Skip and Skippable attributes to facilitate conditional test execution.
- Ensured all test classes are aligned with the latest Xunit v3 standards.
@mikaelweave
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mikaelweave mikaelweave deleted the copilot/update-tests-to-microsoft-testing-platform branch January 31, 2026 16:14
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