Skip to content

Add Stryker.NET mutation testing - #11

Merged
Tzeetzch merged 2 commits into
masterfrom
feature/mutation-testing
Feb 17, 2026
Merged

Add Stryker.NET mutation testing#11
Tzeetzch merged 2 commits into
masterfrom
feature/mutation-testing

Conversation

@PeterKruithof

Copy link
Copy Markdown
Collaborator

Summary

  • Extract services, data, entities, and background services into JunoBank.Core class library
  • Add Stryker.NET mutation testing to CI pipeline (runs in parallel with build/test)
  • Mutation reports uploaded as downloadable artifacts on every PR

Why

Stryker.NET can't compile Blazor projects (Razor source generators don't run during Stryker's Roslyn compilation). Extracting the service layer into a plain class library solves this while also improving architecture — business logic is now cleanly separated from the UI.

What changed

  • New project: src/JunoBank.Core/ — all services, entities, DbContext, migrations, utils, background services
  • JunoBank.Web now references Core, keeps only: Components, Auth (Blazor-specific), BrowserTimeService, Program.cs
  • Tests reference Core instead of Web (all 154 pass)
  • Namespaces preserved via <RootNamespace>JunoBank.Web</RootNamespace> — zero code changes needed in existing files
  • Dockerfile updated to copy Core project
  • Solution updated with Core project

Baseline mutation score

  • 28.79% (350 killed / 562 tested / 1394 total mutants)
  • 664 mutants have no test coverage at all
  • This gives us a concrete metric to improve over time

Test plan

  • 154 unit tests pass
  • 72/73 E2E tests pass (1 known flaky: request-withdrawal timing)
  • Stryker runs successfully and produces HTML report
  • Docker build includes Core project
  • CI mutation testing job completes on this PR

🤖 Generated with Claude Code

PeterKruithof and others added 2 commits February 17, 2026 15:11
Extract services, data, and entities into JunoBank.Core class library
to enable mutation testing (Stryker can't compile Blazor projects due
to Razor source generators). Namespaces preserved via RootNamespace.

Baseline mutation score: 28.79% (350 killed / 562 tested mutants).
CI runs mutation testing on every PR with downloadable HTML report.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CI now posts a comment on every PR showing the mutation score
compared to the baseline. Updates existing comment on re-runs.

Baseline: 47.95% (339 detected / 707 total mutants)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🧬 Mutation Testing

Metric Value
Score 47.95% ➡️ (0.00% vs baseline)
Killed 337
Survived 134
No Coverage 234
Timeout 2
What does this mean?

Stryker mutates your code (flips conditions, removes lines, changes values) and runs tests against each mutation. Killed = tests caught it (good). Survived = tests missed it (weak spot). No Coverage = no test touches this code.

Download the full HTML report from the Artifacts section below for per-file details.

@Tzeetzch
Tzeetzch merged commit 4c496ae into master Feb 17, 2026
2 checks passed
@Tzeetzch
Tzeetzch deleted the feature/mutation-testing branch February 17, 2026 14:43
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