Migrate test infrastructure from xUnit v2 to xUnit v3#52930
Draft
MichaelSimons wants to merge 15 commits intodotnet:mainfrom
Draft
Migrate test infrastructure from xUnit v2 to xUnit v3#52930MichaelSimons wants to merge 15 commits intodotnet:mainfrom
MichaelSimons wants to merge 15 commits intodotnet:mainfrom
Conversation
Youssef1313
reviewed
Feb 10, 2026
e96ea06 to
4682347
Compare
34b941b to
6769ca8
Compare
19ee58c to
d7555cd
Compare
3 tasks
a9a64c3 to
e9b7d9e
Compare
Youssef1313
reviewed
Feb 28, 2026
776bf9e to
f8ce147
Compare
201d8bb to
8840659
Compare
Switch all ~55 test projects from xUnit v2 (2.9.3) to xUnit v3 (3.1.0) using the arcade SDK's built-in XUnitV3.targets support. Key changes: - Enable TestRunnerName=XUnitV3 in test/Directory.Build.props - Switch from Microsoft.DotNet.XUnitExtensions to XUnitV3Extensions - Upgrade Xunit.Combinatorial 1.3.2 -> 2.0.24 (v3-compatible) - Switch Verify.Xunit -> Verify.XunitV3 - Rewrite test entry point (Program.cs) as ModuleInitializer - Update ITestOutputHelper implementations (new Write/Output members) - Fix IMessageSink namespace (Xunit.Abstractions -> Xunit.Sdk) - Fix DiagnosticMessage namespace (Xunit.Sdk -> Xunit.v3) - Add CallerFilePath/CallerLineNumber ctors for custom attributes (xUnit3003) - Rewrite dotnet-format custom discoverers using IBeforeAfterTestAttribute - Exclude transitive v2 assemblies that conflict with v3 types - Add TestContext alias to resolve Xunit.TestContext ambiguity - Use xunit.v3.assert for non-test projects (SDDLTests) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eues xUnit v3 runs tests out-of-process via a native AppHost, so when cross-compiling (e.g. ARM64 macOS build targeting x64 Helix queues) the publish step must set RuntimeIdentifier to produce the correct AppHost architecture. In CI, Arcade's centralized NuGet restore (via NuGet.targets) does not include RuntimeIdentifier, so the assets file lacks the RID target. An explicit Restore with RuntimeIdentifiers (plural) is added before PublishWithOutput to inject the RID target without clobbering multi-TFM transitive dependencies (e.g. BrowserRefresh which targets net6.0). ErrorOnDuplicatePublishOutputFiles=false suppresses NETSDK1152 from Exe project-references (e.g. dotnet.csproj) whose outputs appear in both the plain-TFM and RID-qualified directories. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…etPackageAdd WarmUpNuGetCache: check exit code, add timeout handling, and verify ILLink analyzer DLLs exist after warm-up so failures are surfaced instead of silently causing CSC-only assertion failures. GivenDotnetPackageAdd file-based tests: use RestoreAdditionalProjectSources instead of RestoreSources to add local package paths without replacing NuGet.config feeds. With xUnit v3 hash-based ordering, the NuGet cache may not be pre-populated when these tests run. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… dependency Both tests created a tool named MyFileBasedTool v1.0.0 with different source. With xUnit v3 hash-based ordering, Pack_CustomPath runs first and installs the tool; Pack then reuses the cached install instead of its own nupkg, missing the #if !DEBUG output. Rename to PackTool and PackCustomPathTool respectively. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WarmUpNuGetCache was using raw Process.Start which did not set the NUGET_PACKAGES environment variable that DotnetCommand sets via AddTestEnvironmentVariables. This caused packages to be restored to the default NuGet cache (~/.nuget/packages) while the actual tests resolved to the artifacts cache, so the ILLink analyzer DLLs were not found and GetBuildLevel() fell back to BuildLevel.All.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related to #52914.
Switch all ~55 test projects from xUnit v2 (2.9.3) to xUnit v3 (3.1.0) using the arcade SDK's built-in XUnitV3.targets support.
Key changes: