Skip to content

Upgrade to XUnit v3#38277

Open
AndriySvyryd wants to merge 5 commits into
mainfrom
XUnitV3
Open

Upgrade to XUnit v3#38277
AndriySvyryd wants to merge 5 commits into
mainfrom
XUnitV3

Conversation

@AndriySvyryd
Copy link
Copy Markdown
Member

Review commit-by-commit for sanity

Copilot 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.
Copilot AI review requested due to automatic review settings May 15, 2026 02:46
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner May 15, 2026 02:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

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