Skip to content

EF-475: Migrate unit and functional tests to xunit v3 - #376

Open
damieng wants to merge 4 commits into
mongodb:mainfrom
damieng:EF-475
Open

damieng wants to merge 4 commits into
mongodb:mainfrom
damieng:EF-475

Conversation

@damieng

@damieng damieng commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Migrates UnitTests and FunctionalTests to xunit v3. SpecificationTests stays on xunit v2 because the EF Core specification test bases require it.

  • xunit reference moved from tests/Directory.Build.props into each test project.
  • SpecificationTests no longer references FunctionalTests (it pulled xunit.v3 in transitively). The few utilities it needs are copied into SpecificationTests/Utilities/; they should move to a shared project later.
  • ShadowPropertyTests.Shadow_property_can_be_used_for_rowversion depended on test order (model cached per context type), which v3 exposed. It now bypasses the model cache.

All tests pass on EF8, EF9 and EF10.

damieng and others added 3 commits October 6, 2026 14:55
Move the xunit package reference out of tests/Directory.Build.props and into
each test project so projects can migrate independently. UnitTests now uses
xunit.v3; FunctionalTests and SpecificationTests stay on xunit 2.9.3 for now.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Reference xunit.v3 instead of xunit 2.9.3
- IAsyncLifetime fixtures now return ValueTask
- Custom Fact/Theory attributes set Skip in their constructor (Skip is no
  longer virtual) and pass through source information
- Drop the Xunit.Abstractions usings (ITestOutputHelper now lives in Xunit)
- Remove the Xunit.TestFramework assembly attribute; it named a type from an
  assembly that is not referenced anywhere
- Suppress xUnit1051 for now (CancellationToken analyzer)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ent test

SpecificationTests must stay on xunit v2 (the EF Core specification test
bases are built against it), but its project reference to FunctionalTests
pulled xunit.v3 in transitively and broke the build with ambiguous types.

- Remove the FunctionalTests project reference
- Copy the test-server utilities it needs (TestServer, TestContainersTestServer,
  ExternalDatabaseTestServer, TestDatabaseNamer, MongoCondition and the Atlas
  container builder) into SpecificationTests, using the xunit v2 signatures
- Make Shadow_property_can_be_used_for_rowversion bypass the model cache so it
  no longer depends on test order, which xunit v3 changed

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@damieng
damieng requested a review from a team as a code owner October 6, 2026 13:55
@damieng
damieng requested review from ajcvickers and a balanced review from Copilot October 6, 2026 13:55

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.

Copilot review overview

Review effort: Balanced
Findings: None


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

…ts sequentially on MongoDB 5.0/6.0

The xunit v3 migration decoupled SpecificationTests from FunctionalTests, and
dotnet test on the solution now runs them concurrently against one server:

- Give each assembly its own database name prefix that includes the EF version
  (EF<n>-FunctionalTest-, EF<n>-SpecTest-). Both assemblies previously generated
  identical names and their startup cleanup, which drops databases by prefix,
  dropped the other's live databases.
- On MongoDB 5.0 and 6.0, overlapping writes intermittently fail with 'Unable to
  read from a snapshot due to pending collection catalog changes'. Run each test
  project in turn with sequential test collections on those servers only. This
  needs MONGODB_VERSION to be the matrix VERSION rather than the Evergreen
  version id. 7.0 and later keep the solution-level run.
- Remove the assembly-level DisableTestParallelization from FunctionalTests.
- Update AGENTS.md and the spec-conformance reviewer to match.

This branch has not been deployed

No deployments
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.

3 participants