feat: migrate Domain.Tests to xUnit v3 (#163)#170
Conversation
- Add xunit.v3 3.2.2 to Directory.Packages.props - Replace xunit → xunit.v3 package reference in Domain.Tests.csproj - Add xunit.runner.json with v3-compatible runner configuration - All 42 tests pass; no source file changes required (simple Facts/Theories) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🏗️ PR Added to Squad Triage QueueThis PR has been labeled with Next steps:
|
There was a problem hiding this comment.
Pull request overview
Migrates tests/Domain.Tests from xUnit v2 to xUnit v3 as a pilot for the broader multi-sprint rollout, while keeping the rest of the test projects on xUnit v2.
Changes:
- Added
xunit.v3(3.2.2) to central package versions alongside existingxunitv2. - Switched
tests/Domain.Teststo referencexunit.v3and added an xUnit runner config file to output. - Introduced
tests/Domain.Tests/xunit.runner.jsonwith parallelization and method display settings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
Directory.Packages.props |
Adds centrally-managed version for xunit.v3 to enable per-project migration. |
tests/Domain.Tests/Domain.Tests.csproj |
Switches the test framework package to xunit.v3 and copies runner config to output. |
tests/Domain.Tests/xunit.runner.json |
Adds xUnit runner configuration for Domain.Tests. |
| <PackageReference Include="xunit.v3"/> | ||
| <PackageReference Include="xunit.runner.visualstudio"/> |
There was a problem hiding this comment.
The migration to xUnit v3 in this project is missing the <OutputType>Exe</OutputType> change required by issue #163 (and recommended by the xUnit v3 migration guide for the new test host). Add OutputType=Exe in the main <PropertyGroup> for this project so the PR meets the acceptance criteria and avoids runner/adapter surprises.
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest"/> |
There was a problem hiding this comment.
xunit.runner.json is already included by the SDK as a None item; adding it as Content Include=... can lead to the file being present in multiple item lists and makes this project inconsistent with the existing pattern in Web.Tests.Integration (which uses <None Update=...>). Prefer updating the existing None item (or removing the default inclusion) and set CopyToOutputDirectory there.
| <Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest"/> | |
| <None Update="xunit.runner.json" CopyToOutputDirectory="PreserveNewest"/> |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## sprint/7-xunit-v3-pilot #170 +/- ##
==========================================================
Coverage ? 72.53%
==========================================================
Files ? 43
Lines ? 721
Branches ? 112
==========================================================
Hits ? 523
Misses ? 149
Partials ? 49 🚀 New features to boost your workflow:
|
Summary
Migrates
Domain.Testsfrom xUnit v2 (2.9.3) to xUnit v3 (3.2.2) as the pilot project for Sprint 7.Working as Gimli (Tester) 🪓
Closes #163
Changes
Directory.Packages.propsxunit.v3 3.2.2alongside existingxunit 2.9.3(other projects unaffected)tests/Domain.Tests/Domain.Tests.csprojxunit→xunit.v3package reference; addedxunit.runner.jsonas contenttests/Domain.Tests/xunit.runner.jsonZero source changes required — the 42 test files use simple
[Fact]/[Theory]patterns with noITestOutputHelper,IAsyncLifetime, or collection fixtures. TheXunitnamespace is unchanged in v3.Test Results
Notes
xunit.runner.visualstudio 3.1.5was already in place and is v3-compatible — no change needed.