test(integration): migrate Web.Tests.Integration to xUnit v3 - #200
Conversation
- Swap xunit (v2) → xunit.v3 package reference - Fix xunit.runner.json item from <None Update> to <Content Include> - Delete stale IntegrationTest1.cs (Aspire starter template, unused) - Fix file headers in all 6 source files (Integration.Tests → Web.Tests.Integration) - Update IAsyncLifetime signatures: Task → ValueTask (xUnit v3 requirement) - Thread TestContext.Current.CancellationToken through all async repo/cache calls to satisfy xUnit1051 (proper xUnit v3 idiom; all methods already accept CT) Closes #199 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🏗️ PR Added to Squad Triage QueueThis PR has been labeled with Next steps:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Migrates the tests/Web.Tests.Integration project from xUnit v2 to xUnit v3 to align with the established patterns used in the other test projects, including runner config handling and v3 async/cancellation conventions.
Changes:
- Updated the integration test project to reference
xunit.v3and includexunit.runner.jsonas copied content. - Removed the stale Aspire starter/template test file (
IntegrationTest1.cs). - Updated fixtures/tests to match xUnit v3 requirements (
IAsyncLifetimeValueTaskmethods) and to threadTestContext.Current.CancellationTokenthrough async calls.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Web.Tests.Integration/Web.Tests.Integration.csproj | Switches to xunit.v3 and standardizes runner JSON inclusion/copy behavior. |
| tests/Web.Tests.Integration/IntegrationTest1.cs | Removes a commented-out template file that doesn’t belong in the active suite. |
| tests/Web.Tests.Integration/Infrastructure/RedisFixture.cs | Updates IAsyncLifetime to ValueTask and fixes header project naming. |
| tests/Web.Tests.Integration/Infrastructure/MongoDbFixture.cs | Updates IAsyncLifetime to ValueTask and fixes header project naming. |
| tests/Web.Tests.Integration/Infrastructure/BlogPostIntegrationCollection.cs | Fixes header project naming consistency. |
| tests/Web.Tests.Integration/Infrastructure/RedisCachingCollection.cs | Fixes header project naming consistency. |
| tests/Web.Tests.Integration/Caching/BlogPostCacheServiceTests.cs | Threads xUnit v3 TestContext cancellation token through cache service calls; fixes header. |
| tests/Web.Tests.Integration/BlogPosts/MongoDbBlogPostRepositoryTests.cs | Threads xUnit v3 TestContext cancellation token through repository calls; fixes header. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #200 +/- ##
=======================================
Coverage 78.64% 78.64%
=======================================
Files 43 43
Lines 721 721
Branches 112 112
=======================================
Hits 567 567
Misses 108 108
Partials 46 46 🚀 New features to boost your workflow:
|
| <PackageReference Include="Testcontainers.MongoDb" /> | ||
| <PackageReference Include="Testcontainers.Redis" /> | ||
| <PackageReference Include="xunit" /> | ||
| <PackageReference Include="xunit.v3" /> | ||
| <PackageReference Include="xunit.runner.visualstudio" /> | ||
| </ItemGroup> |
There was a problem hiding this comment.
After deleting IntegrationTest1.cs, the test project no longer appears to use Aspire.Hosting.Testing (or the related entries) and there are no code references to the AppHost project either. Consider removing the unused package/usings and the AppHost project reference to reduce restore/build time and keep the integration suite focused; they can be re-added when Aspire-based tests are introduced again.
mpaulosky
left a comment
There was a problem hiding this comment.
Aragorn — Lead Architect Review ✅ LGTM — READY TO MERGE
PR: test(integration): migrate Web.Tests.Integration to xUnit v3 | Branch: squad/199-web-tests-integration-xunit-v3 | Closes #199
Gate Checklist
| Gate | Result |
|---|---|
| CI fully green (18/18 checks) | ✅ |
| Copilot review — no comments generated | ✅ |
| Codecov — 78.64% → 78.64% (no change) | ✅ |
Branch naming squad/* |
✅ |
Closes #199 in body |
✅ |
| No production code changes | ✅ |
| 273 tests pass (12/12 integration) | ✅ |
Technical Review
Migration correctness — all four v3 requirements applied correctly:
xunit→xunit.v3— correct package swap;xunit.runner.visualstudioretained unchanged (supports both v2 and v3).IAsyncLifetimeValueTaskshape —MongoDbFixtureandRedisFixtureupdated fromasync Task→async ValueTask. Correct fix for the xUnit v3 breaking interface change.xUnit1051/TestContext.Current.CancellationToken— all async repository and cache service calls now threadct.Task.Delay(20, ct)is a precise improvement.- Runner JSON
<Content Include>— correct swap from<None Update>. xUnit v3 requires content-copy semantics;PreserveNewestpreserved.
IntegrationTest1.cs deletion — appropriate. Stale Aspire starter template with 100% commented-out methods has no place in the active suite.
Runner settings preserved — parallelizeAssembly: false / parallelizeTestCollections: true is correct for Testcontainers-based integration tests that share Docker containers. Changing this would introduce port conflicts and flaky tests.
File header corrections — Integration.Tests → Web.Tests.Integration fixed in all 6 files. Consistent with the repo copyright-header standard.
Scope — surgical. Nothing outside tests/Web.Tests.Integration/ was touched. No production code changes were needed.
Verdict: APPROVED (as Aragorn, Lead Architect)
Note: GitHub cannot self-approve; this review is posted as COMMENT per platform constraint. Verdict is APPROVED.
Merge command:
gh pr merge 200 --squash --delete-branchSquash commit message:
test(integration): migrate Web.Tests.Integration to xUnit v3 (#200)
- Swap xunit → xunit.v3 package; fix runner JSON to Content Include
- IAsyncLifetime fixtures updated to ValueTask shape (xUnit v3 requirement)
- Thread TestContext.Current.CancellationToken through all async calls (xUnit1051)
- Delete stale IntegrationTest1.cs (Aspire starter template)
- Fix file headers: Integration.Tests → Web.Tests.Integration in 6 files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sprint 11 — Issue #199: ready to move to Done on merge. Board automation will handle the transition automatically.
Summary
Migrates
tests/Web.Tests.Integrationfrom xUnit v2 to xUnit v3 (3.2.2), matching the pattern already established byWeb.TestsandWeb.Tests.Bunit.Working as Gimli (Tester)
Closes #199
Changes
Web.Tests.Integration.csprojxunit→xunit.v3; runner JSON item:<None Update>→<Content Include>IntegrationTest1.csMongoDbFixture.cs/RedisFixture.csIAsyncLifetime:async Task→async ValueTask(xUnit v3 requirement); file headers fixedBlogPostIntegrationCollection.cs/RedisCachingCollection.csMongoDbBlogPostRepositoryTests.csTestContext.Current.CancellationTokenBlogPostCacheServiceTests.csTestContext.Current.CancellationTokenxUnit v3 migration notes
IAsyncLifetimenow requiresValueTaskforInitializeAsyncandDisposeAsync— fixtures updated accordingly.xUnit1051(useTestContext.Current.CancellationToken) resolved by threadingctthrough all repository and cache service calls. All methods already acceptedCancellationTokenas an optional parameter — no production code changes required.parallelizeAssembly: false/parallelizeTestCollections: truekept to avoid Docker container conflicts during parallel collection runs.Verification
All pre-push gates passed: