Skip to content

Migrate Architecture.Tests to xUnit v3 (#178) - #184

Merged
mpaulosky merged 1 commit into
sprint/8-xunit-v3-pilotfrom
squad/178-migrate-architecture-tests-xunit-v3
Apr 26, 2026
Merged

Migrate Architecture.Tests to xUnit v3 (#178)#184
mpaulosky merged 1 commit into
sprint/8-xunit-v3-pilotfrom
squad/178-migrate-architecture-tests-xunit-v3

Conversation

@mpaulosky

Copy link
Copy Markdown
Owner

Summary

Migrates Architecture.Tests test methods to xUnit v3 API conventions, following the Sprint 7 Domain.Tests pilot pattern.

Closes #178

Working as Gimli (Tester)


What Changed

All 4 test files updated with proper xUnit v3 migration conventions:

File Tests Change
DomainLayerTests.cs 4 AAA comments + extract assembly variable for clean Arrange/Act split
VsaLayerTests.cs 3 AAA comments + extract domainAssembly variable
ThemeLayerTests.cs 2 AAA comments
CachingLayerTests.cs 2 AAA comments

Total: 11 tests migrated

xUnit v3 API Observations

  • [Fact] attribute is identical in xUnit v2 and v3 — no attribute changes required
  • No async/await patterns in architecture tests — no lifecycle changes needed
  • No IClassFixture / ICollectionFixture — stateless tests, no collection changes needed
  • FluentAssertions .Should() works unchanged with xUnit v3
  • Parallelization via xunit.runner.json was already configured in Wave 1 (Add xUnit v3 packages to Architecture.Tests (#176) #182)

Pattern Reference (Sprint 7 Domain.Tests Pilot)

Followed the same approach as the Sprint 7 Domain.Tests migration:

Test Results

Passed! - Failed: 0, Passed: 11, Skipped: 0, Total: 11 — Architecture.Tests.dll
Passed! - Failed: 0, Passed: 42, Skipped: 0, Total: 42 — Domain.Tests.dll

Zero failures. Ready to merge to sprint/8-xunit-v3-pilot.

- Add AAA (Arrange/Act/Assert) comments to all 11 test methods
- Extract assembly variable in DomainLayerTests for cleaner Arrange/Act split
- No xUnit attribute changes needed — [Fact] is identical in v2 and v3
- Follows Sprint 7 Domain.Tests pilot pattern (FluentAssertions + xunit.v3)
- All 11 architecture tests pass with xunit.v3 3.2.2

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 26, 2026 13:20
@github-actions

Copy link
Copy Markdown
Contributor

🏗️ PR Added to Squad Triage Queue

This PR has been labeled with squad and added to the triage queue.

Next steps:

  • The squad Lead will review and assign to an appropriate team member
  • A squad:member label will be added after triage

If you know which squad member should handle this, you can add the appropriate squad:member label yourself.

@github-actions github-actions Bot added the squad Squad triage inbox — Lead will assign to a member label Apr 26, 2026
@mpaulosky
mpaulosky merged commit 206605e into sprint/8-xunit-v3-pilot Apr 26, 2026
15 checks passed
@mpaulosky
mpaulosky deleted the squad/178-migrate-architecture-tests-xunit-v3 branch April 26, 2026 13:23
mpaulosky added a commit that referenced this pull request Apr 26, 2026
## Summary

Post-migration validation for Architecture.Tests xUnit v3 migration. No
failures found.

Closes #179

**Working as Gimli (Tester)**

---

## Findings

After applying the xUnit v3 migration in PR #184, all 11 architecture
tests pass with zero failures:

```
Passed! - Failed: 0, Passed: 11, Skipped: 0, Total: 11 — Architecture.Tests.dll (72ms)
```

**No fixes required.** The Architecture.Tests migration in Wave 2 is
clean.

## Root Cause Analysis

xUnit v3 is fully backward-compatible for all patterns used in
Architecture.Tests:
- `[Fact]` — identical in v2 and v3 ✅
- FluentAssertions `.Should()` — unchanged ✅  
- NetArchTest.Rules builder chain — unchanged ✅
- No `IClassFixture` / `ICollectionFixture` patterns in use ✅
- No xUnit lifecycle overrides (`IAsyncLifetime`, `SetupAttribute`) ✅

The only migration work was Gimli Rule #3 compliance (AAA comments),
which is purely cosmetic
and cannot introduce test failures.

## Deliverables

- ✅ Validated: 11 tests pass with xUnit v3 3.2.2
- ✅ Appended Sprint 8 Wave 2 learnings to
`.squad/agents/gimli/history.md`
- ✅ Drafted `gimli-xunit-v3-migration-pattern.md` decision (in local
decisions inbox for Scribe)

## Prerequisite

This PR should merge after #184 is merged to `sprint/8-xunit-v3-pilot`.

Co-authored-by: Boromir <boromir@squad.dev>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates Architecture.Tests test methods to follow the repo’s xUnit v3 migration conventions (matching the earlier Domain.Tests pilot) without changing the underlying architectural rules being asserted.

Changes:

  • Added AAA (Arrange/Act/Assert) comments to all Architecture.Tests test methods.
  • Extracted local Assembly variables in domain-related tests to clarify Arrange vs Act separation.
  • Minor variable renames to align with consistent assertion style (result.IsSuccessful).

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/Architecture.Tests/DomainLayerTests.cs Adds AAA structure and extracts assembly local for clearer Arrange/Act split.
tests/Architecture.Tests/VsaLayerTests.cs Adds AAA comments, renames locals to result, extracts domainAssembly in one test.
tests/Architecture.Tests/ThemeLayerTests.cs Adds AAA comments around NetArchTest rule execution.
tests/Architecture.Tests/CachingLayerTests.cs Adds AAA comments around caching dependency rules and assertions.

Comment on lines 19 to 23
public void Features_Should_Not_Reference_Each_Other()
{
// BlogPosts slice should not reference UserManagement and vice versa
var blogPostsResult = Types.InAssembly(WebAssembly)
// Arrange / Act — BlogPosts slice should not reference UserManagement and vice versa
var result = Types.InAssembly(WebAssembly)
.That()

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

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

Features_Should_Not_Reference_Each_Other (and the new comment text) implies a two-way dependency check, but the current rule only verifies that types in MyBlog.Web.Features.BlogPosts don’t depend on MyBlog.Web.Features.UserManagement. Either add a second assertion for the reverse direction (UserManagement → BlogPosts) or rename/adjust the test name and comment to match the one-way check.

Copilot uses AI. Check for mistakes.
Comment on lines 22 to 26
var result = Types.InAssembly(WebAssembly)
.That()
.ResideInNamespace("MyBlog.Web.Components.Theme")
.Should()
.ResideInNamespace("MyBlog.Web.Components.Theme")

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

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

This test is effectively tautological: it filters to types already in MyBlog.Web.Components.Theme and then asserts those types reside in the same namespace, so it can’t fail if the namespace exists. Consider selecting theme components by a different predicate (e.g., name starts with "Theme" / assignable to ComponentBase) and asserting they reside in MyBlog.Web.Components.Theme.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +21
// Arrange
var assembly = typeof(BlogPost).Assembly;

// Act
var result = Types.InAssembly(assembly)

Copilot AI Apr 26, 2026

Copy link

Choose a reason for hiding this comment

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

typeof(BlogPost).Assembly is repeated in each test method; consider extracting a single private static readonly Assembly DomainAssembly = typeof(BlogPost).Assembly; (or similar) at the class level to reduce duplication and keep the Arrange sections focused on test-specific setup.

Copilot uses AI. Check for mistakes.
@codecov

codecov Bot commented Apr 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (sprint/8-xunit-v3-pilot@5f1f102). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             sprint/8-xunit-v3-pilot     #184   +/-   ##
==========================================================
  Coverage                           ?   72.53%           
==========================================================
  Files                              ?       43           
  Lines                              ?      721           
  Branches                           ?      112           
==========================================================
  Hits                               ?      523           
  Misses                             ?      149           
  Partials                           ?       49           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

squad Squad triage inbox — Lead will assign to a member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants