Skip to content

refactor(test): migrate to xUnit v3 - #10722

Merged
ReubenBond merged 9 commits into
dotnet:mainfrom
ReubenBond:rb-migrate-xunit-v3
Aug 20, 2026
Merged

ReubenBond merged 9 commits into
dotnet:mainfrom
ReubenBond:rb-migrate-xunit-v3

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 20, 2026 •

Copy link
Copy Markdown
Member

xUnit v2 is no longer the current test platform for the repository's supported .NET targets. This migrates the Orleans test infrastructure and suite to xUnit v3 while preserving VSTest execution, existing trait filters, provider skip behavior, and custom test executable roles.

The migration:

  • replaces xUnit v2 packages and Verify.Xunit with their xUnit v3-compatible counterparts
  • converts test projects to executable v3 test applications while keeping IsTestingPlatformApplication disabled for VSTest
  • updates IAsyncLifetime, dynamic skips, custom traits, test ordering, theory data, and output helper APIs
  • preserves custom executable entry points used by standalone silo hosts and benchmarks by dispatching test-platform invocations to xUnit's generated runner
  • defers provider prerequisite failures to test construction so unavailable external services remain skipped instead of failing fixture initialization
  • updates maintained documentation test projects and generated public API surfaces

The package changes, remaining project fixes, and source/API migration are split into separate commits for reviewability.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 20, 2026 19:36

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 migrates the Orleans test suite and test infrastructure from xUnit v2 to xUnit v3, updating both package references and source-level test patterns so the suite continues to run under VSTest with existing trait/category filtering and skip semantics.

Changes:

  • Updates package references to xUnit v3 (xunit.v3*) and Verify.XunitV3, and adjusts test project output/entry-point behavior for v3 executable test apps.
  • Replaces v2-era skip/trait/test-lifetime patterns (SkippableFact/Theory, IAsyncLifetime returning Task, etc.) with xUnit v3 equivalents (SkipException.ForSkip, Assert.SkipWhen, ValueTask lifetimes, ITraitAttribute.GetTraits, etc.).
  • Preserves custom test executables (standalone silo hosts/benchmarks) by dispatching to xUnit’s generated runner when invoked by the test platform.
Show a summary per file
File Description
Directory.Packages.props Switches centrally-managed versions from xUnit v2/SkippableFact/Verify.Xunit to xUnit v3 and Verify.XunitV3.
Directory.Build.props Disables IsTestingPlatformApplication globally to keep VSTest execution behavior consistent during migration.
test/Directory.Build.props Adds xUnit analyzer suppression and sets test projects to build as executables based on project name suffix.
test/TestInfrastructure/TestExtensions/TestClusterPerTest.cs Updates test cluster lifetime contract to xUnit v3 IAsyncLifetime (ValueTask) and adds PreconditionsMet support.
test/TestInfrastructure/TestExtensions/TestCategory.cs Reworks TestCategoryAttribute to xUnit v3 trait discovery via ITraitAttribute.GetTraits().
test/TestInfrastructure/TestExtensions/TestUtils.cs Converts environment prerequisite failures into xUnit v3 skip exceptions (SkipException.ForSkip).
test/TestInfrastructure/TestExtensions/TestOutputHelperExtensions.cs Moves output helper extensions to the xUnit v3 namespace/API surface and avoids null-sensitive ToString().
test/Benchmarks/Serialization/Comparison/ArraySerializeBenchmark.cs Updates benchmark/test hybrid methods; currently introduces xUnit TestContext usage (see comment).
test/Benchmarks/Program.cs Dispatches to xUnit’s generated entry point when invoked as a test platform application.
test/Orleans.Runtime.Tests/Program.cs Preserves the standalone silo host entry point while dispatching test invocations to the xUnit-generated runner.
src/Orleans.Transactions.TestKit.xUnit/* Converts transaction testkit runners from SkippableFact/Theory to xUnit v3 Fact/Theory patterns.
Many test/**.cs files Mechanical updates: remove Xunit.Abstractions, replace SkippableFact/Theory with Fact/Theory, add cancellation tokens via TestContext.Current.CancellationToken, and update lifetime signatures to ValueTask.

Review details

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

  • Files reviewed: 300/406 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread test/Extensions/Orleans.Azure.Tests/AzureStorageBasicTests.cs
Comment thread test/Benchmarks/Serialization/Comparison/ArraySerializeBenchmark.cs
Copilot AI review requested due to automatic review settings August 20, 2026 19:53

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.

Review details

  • Files reviewed: 300/406 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings August 20, 2026 21:00

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.

Review details

  • Files reviewed: 300/408 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings August 20, 2026 21:45
@ReubenBond
ReubenBond force-pushed the rb-migrate-xunit-v3 branch from f2aaab0 to a7fcf73 Compare August 20, 2026 21:45

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.

Review details

  • Files reviewed: 300/409 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread test/Orleans.Runtime.Internal.Tests/TimeoutTests.cs Outdated
ReubenBond and others added 7 commits August 20, 2026 16:03
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

Review details

  • Files reviewed: 300/422 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread test/Orleans.DefaultCluster.Tests/SiloRoleBasedPlacementDirectorTests.cs Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 20, 2026 23:23
@ReubenBond
ReubenBond force-pushed the rb-migrate-xunit-v3 branch from ba20727 to 576a967 Compare August 20, 2026 23:23

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.

Review details

  • Files reviewed: 300/421 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 75c4938a-e86a-4cf1-95d3-4695243217fc
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 20, 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.

2 participants