Files
git.stella-ops.org/docs/technical/testing/mutation-testing-baselines.md
2026-01-06 19:07:48 +02:00

2.4 KiB

Mutation Testing Baselines

Sprint: SPRINT_0353_0001_0001_mutation_testing_integration Task: MUT-0353-005

This document tracks mutation testing baselines for critical modules.

Baseline Scores

Module Initial Score Target Score Date Established
Scanner.Core 72% ≥ 80% 2025-12-16
Policy.Engine 68% ≥ 80% 2025-12-16
Authority.Core 75% ≥ 85% 2025-12-16
Signer.Core 70% ≥ 80% TBD
Attestor.Core 65% ≥ 80% TBD
Reachability.Core 60% ≥ 75% TBD

Threshold Configuration

See stryker-thresholds.json for per-module threshold configuration.

Mutation Operators Applied

Operator Description Enabled
Arithmetic Replace +, -, *, /, %
Boolean Flip true/false
Comparison Replace <, >, <=, >=, ==, !=
Logical Replace &&,
String Mutate string literals
Linq Mutate LINQ methods
NullCoalescing Mutate ?? operators
Assignment Mutate assignment operators

Exclusions

The following patterns are excluded from mutation testing:

  • **/Migrations/** - Database migrations (tested via integration tests)
  • **/Generated/** - Generated code
  • **/*.g.cs - Source-generated files
  • **/Models/** - Simple data transfer objects
  • **/Exceptions/** - Exception types (tested via integration)

Running Mutation Tests

Local Execution

# Run mutation tests for a specific module
cd src/Scanner/__Libraries/StellaOps.Scanner.Core
dotnet stryker

# Run with specific configuration
dotnet stryker -f stryker-config.json --reporter html

# Quick mode (fewer mutations, faster feedback)
dotnet stryker --since:main

CI Execution

Mutation tests run on:

  • Merge requests targeting main
  • Weekly scheduled runs (comprehensive)

Results are uploaded as artifacts and published to the mutation testing dashboard.

Improving Mutation Score

  1. Add missing test cases - Cover edge cases revealed by surviving mutants
  2. Strengthen assertions - Replace weak assertions with specific ones
  3. Test boundary conditions - Cover off-by-one and boundary scenarios
  4. Add negative tests - Test that invalid inputs are rejected

References