Skip to content

Migrate test infrastructure from xUnit v2 to xUnit v3 #9873

@MichaelSimons

Description

@MichaelSimons

Overview

The repo currently uses xUnit v2 for its test infrastructure across ~50+ test projects. xUnit v3 has reached stable release and the arcade SDK already ships full support via XUnitV3.targets. We should migrate to take advantage of the improvements.

Note: There is a coupling between the templating and sdk repos in the templating test infrastructure which prevents the sdk from upgrading to xunit v3 - dotnet/sdk#52914

Why upgrade

Performance & execution model

  • Tests compile to self-contained executables, eliminating the external runner process and the overhead of assembly loading/reflection at startup.
  • Improved parallel execution with a new algorithm that better distributes work across threads.

Modern .NET alignment

  • Built directly on top of Microsoft.Testing.Platform, the modern test platform that replaces VSTest internals.
  • First-class support for ValueTask throughout the API (IAsyncLifetime, data attributes, etc.).
  • Native support for generic test methods, required members, and other modern C# features.

Better diagnostics & developer experience

  • Rich assertion failure messages with improved output formatting (printMaxStringLength, printMaxObjectDepth, etc.).
  • Built-in support for explicit tests ([Fact(Explicit = true)]) — tests that only run when specifically requested.
  • Assert.Equivalent for deep structural comparison without requiring ordering.
  • Improved theory data with ITheoryDataRow, typed TheoryData<> up to 10 parameters, and MemberData that works with properties, methods, and fields.

Simplified extensibility

  • Data attributes are self-describing — no more separate IDataDiscoverer classes needed alongside custom DataAttribute implementations.
  • Streamlined fixture and lifecycle model.

Ecosystem

  • xUnit v2 is in maintenance mode. New features, performance work, and bug fixes are v3-only.
  • Arcade SDK already defines XUnitV3Version and provides XUnitV3.targets + XUnitV3.Runner.targets, so the build infrastructure is ready.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions