Upgrade to XUnit v3#38277
Open
AndriySvyryd wants to merge 5 commits into
Open
Conversation
added 4 commits
May 13, 2026 19:40
… source Updates eng/Versions.props with overrides for the Arcade SDK XUnitV3 defaults so projects opting into the v3 runner pick up xunit.v3 4.0.0-pre.108 (newer than the 3.2.2 default) and the v3-aware xunit.runner.visualstudio. Also pins Microsoft.DotNet.XUnitV3Extensions, which Arcade does not provide a default for. Adds nuget.org to NuGet.config because xunit.v3 4.0.0-pre.108 is not yet mirrored to dotnet-public. No functional change yet -- nothing references the new versions.
For every executable test project (IsUnitTestProject=true):
- TestRunnerName=XUnitV3 in test/Directory.Build.props so Arcade imports
XUnitV3.targets and pulls in xunit.v3.core / xunit.v3.assert /
Microsoft.Testing.Platform automatically.
- OutputType=Exe (xUnit v3 requires stand-alone executables).
EFCore.Specification.Tests (and the Relational/AspNet siblings via transitive
flow) replace xunit.assert/xunit.core/xunit.runner.visualstudio with
xunit.v3.core, xunit.v3.assert and Microsoft.DotNet.XUnitV3Extensions; these
are libraries (IsTestProject=false) so Arcade does not auto-inject the v3
packages.
benchmark/Directory.Build.props swaps xunit.assert -> xunit.v3.assert.
Drops the now-removed Xunit.Abstractions global using from every test csproj.
This commit will not build cleanly on its own -- the local Conditional* / skip-
condition infrastructure under test/EFCore.Specification.Tests/TestUtilities/Xunit/
still targets the v2 extensibility surface and is replaced in the next commit.
…infra
Replaces EF Core's home-grown ITestCondition / ConditionalFactAttribute /
ConditionalTheoryAttribute / discoverer / test-case / message-bus stack with
the Arcade-shared Xunit.ConditionalFactAttribute(Type, params string[]) API.
New static helpers (one static bool per former enum flag) consumed via
typeof(...) + nameof(...) on the conditional attributes:
- test/EFCore.Specification.Tests/TestUtilities/TestConditions.cs (universal:
NotOnHelix / NotOnCI / NotOnMac / NotOnLinux / NotOnWindows / NotOnLinuxOrMac)
- test/EFCore.SqlServer.FunctionalTests/TestUtilities/SqlServerConditions.cs
- test/EFCore.Cosmos.FunctionalTests/TestUtilities/CosmosConditions.cs
- test/EFCore.Sqlite.FunctionalTests/TestUtilities/SqliteConditions.cs
Deleted obsolete files under TestUtilities/Xunit/ and TestUtilities/.
UseCultureAttribute is retained -- BeforeAfterTestAttribute with no Arcade
equivalent.
This commit will not build cleanly on its own; the call-site sweep across
the test tree lands in the next commit.
Mechanical conversions across test/**/*.cs: * [ConditionalFact] / [ConditionalTheory] (no condition attributes) -> [Fact] / [Theory]. ~10,623 occurrences plus inline-stacked variants such as [ConditionalTheory, MemberData(...)] and [ConditionalFact(Skip = ...)]. * [ConditionalFact] / [ConditionalTheory] companioned with an ITestCondition attribute (SqlServerCondition, CosmosCondition, PlatformSkipCondition, SkipOnHelixCondition, SkipOnCiCondition, SpatialiteRequired, SqliteVersionCondition) -> a single [ConditionalFact(typeof(SqlServerConditions), nameof(SqlServerConditions.X), ...)] referencing the static helpers added in the previous commit. Handles inline-stacked and adjacent-line forms. * Class-level orphan condition attributes -> [ConditionalClass(...)]. * Multi-line [PlatformSkipCondition(...)] blocks across MigrationsSqlServerTest, OperationExecutorTest, ConfigPatternsCosmosTest fixed manually; SkipReason text is dropped (Arcade surfaces the failing member name). * SqliteVersionCondition(Min=3.35.0) -> nameof(SqliteConditions.VersionAtLeast3_35). No other Min/Max combos exist in the tree. * using Microsoft.EntityFrameworkCore.TestUtilities.Xunit; removed from files that no longer reference that (now-deleted) namespace. * One stale nameof(SqlServerCondition.SupportsMemoryOptimized) reference in TestEnvironment.cs retargeted to the new SqlServerConditions class. Remaining IAsyncLifetime / UseCultureAttribute v3 breakages land in the following commit.
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.
Review commit-by-commit for sanity