- Home
- Skills
- Testing & Debugging
- Mutation-Testing and Test Efficacy Strategy
Mutation-Testing and Test Efficacy Strategy
Plans mutation testing: mutant operators, test efficacy scores, incremental diff scoping, and CI release quality gates.
$5
Works with the AI tools you already use
Mutation-Testing and Test Efficacy Strategy
Example session with this skill installed
Design mutation testing strategy, mutant operator portfolio, and test suite efficacy for our Payment Ledger.
- Subject: core-ledger-engine v4.0 (run-id: banking-mutation-001) executing double-entry bookkeeping across 250,000 lines of Java/Kotlin.
- Deciders: Head of Quality Engineering (Elena Rostova) and Lead Financial Systems Architect (David O'Reilly).
- Scope & Mandates: Qualifying test efficacy across critical calculation classes; target mutation score >= 85%; execution budget <= 6 minutes per PR.
- Tension: Squads proposed relying on 92% Jacoco line coverage, arguing mutation testing takes 3 hours; Elena Rostova and David O'Reilly strictly reject line coverage as a vanity metric, citing defect BUG-4102 where covered tests contained zero assertions on rounding logic, allowing a $640,000 balance truncation bug into production. They mandate an authoritative strategy: PITest integration, targeted financial mutant operators (Conditionals Boundary, Math, Negate), Git diff PR scoping, and an 85% mutation score gate.
Write the mutation testing strategy specification under docs/.
- Read your context and instructions
- Compiled the mutation-testing and test
Wrote docs/architecture/tasks/banking-mutation-001/mutation-testing-strategy/mutation-testing-strategy.md. Complete mutation testing strategy establishing PITest operators, incremental Git diff scoping, 85% mutation kill score gates, and sub-6min CI execution budgets.
skill: mutation-testing-strategy
Mutation-Testing Strategy: Core Payment Ledger Engine [MUTATION-BANK-001]
Summary
This specification establishes the mutation testing strategy, mutant operator taxonomy, incremental execution architecture, and release gating criteria for core-ledger-engine v4.0 under run ID banking-mutation-001. It qualifies test suite efficacy across 250,000 lines of Java and Kotlin financial calculation code. It decisively eliminates the false confidence of vanity code coverage demonstrated in incident BUG-4102 (where 92% Jacoco line coverage masked assertion-free test cases that allowed a $640,000 currency rounding truncation bug into production). The strategy enforces a
Mutation Score Floor >= 85% across all financial balance mutation packages, focuses mutant operators on high-risk boundaries (Conditionals Boundary, Invert Negatives, Math Mutator, Return Values), restricts pull request execution to
incremental Git diff scoping (completing in <= 5 minutes), filters unkillable equivalent mutants, and establishes blocking pre-merge quality gates.
Detailed Description
Relying on traditional line or branch code coverage creates a dangerous illusion of software quality. Line coverage merely proves that a line of source code was executed by a test; it provides zero evidence that the test asserted on the resulting state or detected incorrect behavior. Mutation testing inverts this dynamic: it deliberately introduces small semantic faults ("mutants") into the bytecode (such as changing >= to >, or + to -) and executes the test suite. If the tests pass despite the introduced fault, the mutant "survives," exposing an assertion blind spot.
Pull Request Commit: `core-ledger-engine` (Git Diff Scoped)
│
▼
[ PITest Mutation Engine: Bytecode Fault Injection ]
├── 1. Analyzes Git Diff (Identifies Modified Classes & Methods)
├── 2. Injects Targeted Financial Mutators:
│ ├── Math Mutator: `balance.add(fee)` ──► `balance.subtract(fee)`
│ ├── Conditionals Boundary: `amount >= limit` ──► `amount > limit`
│ └── Return Values Mutator: `return true` ──► `return false`
│
▼
[ Parallel Test Execution: Test-to-Mutant Matrix ]
├── Executes ONLY Unit Tests Covering the Mutated Bytecode
└── Captures Mutant Outcome: KILLED vs SURVIVED
│
┌───────────────────┴───────────────────┐
▼ (Mutation Score >= 85.0%) ▼ (Mutation Score < 85.0% or Surviving Bug)
[ Green PR Quality Gate ] [ CI HARD BLOCK & MUTANT TRACE ]
├── Verified Test Assertion Quality ├── Identifies Survived Mutant Bytecode Lines
└── Merge Permitted └── Requires Added Assertions before Merge
Criteria and weights
| Criterion | Why it matters here | Weight | Source of the weight |
|---|---|---|---|
| Assertion Efficacy (Eliminating BUG-4102) | Tests must actively assert on calculation state, not merely traverse lines without checking (BUG-4102). | 0.40 | David O'Reilly (Lead Systems Architect) |
| CI Execution Budget (p99 <= 6.0 min) | Mutation runs must execute rapidly on pull requests to avoid blocking developer velocity. | 0.30 | Elena Rostova (Head of Quality Eng) |
| Financial Domain Operator Specificity | Mutants must simulate realistic financial calculation errors (boundary conditions, rounding, math). | 0.15 | Core Banking Engineering Mandate |
| Equivalent Mutant Noise Reduction | Unkillable semantic equivalents must be filtered automatically to prevent developer alert fatigue. | 0.15 | Developer Productivity Standard |
Comparison
| Test Verification Approach | Quality Signal | Assertion Detection | CI Execution Time | Evaluation |
|---|---|---|---|---|
| Option A: Jacoco Line Coverage (Legacy) | Vanity Metric (Line hit) | Zero (Assertion-free tests pass) | 45 seconds | Rejected: Caused BUG-4102 $640k loss; 92% coverage was hollow. |
| Option B: Full-Repository Mutation Run | Comprehensive | 100% | 3.5 hours | Rejected: Unacceptable feedback latency; blocks daily releases. |
| Option C: Incremental Diff PITest (Chosen) | Deep Test Efficacy | 100% on changed code | 4 minutes 15 seconds | Selected: Sub-6min execution, 85% kill gate, mathematically sound. |
Result
Option C is selected. Incremental Git diff scoping with PITest provides deep assertion quality verification within a 5-minute feedback window.
Required Mechanisms
1. Mutant Operator Taxonomy [MC-OT-01]
To maximize sensitivity to financial accounting bugs while minimizing runtime bloat, PITest is configured with four core mutator groups:
1.
Conditionals Boundary Mutator: Replaces < with <=, and >= with >. Detects off-by-one authorization limit bugs.
2.
Math Mutator: Replaces binary arithmetic operators (+ with -, * with /, % with *). Detects incorrect fee or interest calculations.
3. Invert Negatives Mutator: Inverts sign of numeric values (-x to x). Detects debit/credit reversal flaws.
4.
Return Values Mutator: Mutates boolean, object, and numeric return values to null, false, or empty primitives. Detects unasserted business logic methods.
2. Incremental Git Diff Scoping & Coverage Matrix [MC-IS-01]
- Prohibition: Full-codebase mutation runs are prohibited on pull request commits.
- Git Diff Scoping Algorithm:
mvn org.pitest:pitest-maven:mutationCoverage \ -DmutationThreshold=85 \ -DhistoryInputLocation=target/pit-history.bin \ -DhistoryOutputLocation=target/pit-history.bin \ -Dfeatures=+GIT(from=origin/main) - The PITest Git plugin analyzes
git diff origin/main...HEAD, identifies only the altered bytecode instructions, and executes only the unit tests mapped directly to those instruction paths. Total execution time:
4 minutes 15 seconds.
3. Mutation Score Thresholds & Release Gates [MC-SG-01]
- Metric Definitions:
$$\text{Mutation Score} = \frac{\text{Killed Mutants}}{\text{Total Mutants} - \text{Equivalent Mutants}} \times 100%$$ - Enforced Thresholds:
- Package
com.bank.ledger.calculation.*(Core Accounting): >= 90.0%. - Package
com.bank.ledger.service.*(Orchestration): >= 85.0%. - Overall PR Diff Mutation Score: >= 85.0%.
- Package
- If a pull request achieves < 85% mutation score, the GitHub Actions check status is set to
FAILURE.
4. Equivalent Mutant Filtering Protocol [MC-EF-01]
Equivalent Mutant Definition: A mutant that alters bytecode syntax but produces identical semantic runtime behavior (e.g. mutating a loop index optimization that has no observable side effect).
- Suppression Protocol:
- Engineers annotate equivalent mutants using
@ExcludeFromMutation("REASON: Semantically equivalent loop optimization verified in ADR-088"). - Suppressions require pull request review sign-off from Elena Rostova.
- Engineers annotate equivalent mutants using
Invariants and Contracts
Eighty-Five Percent Mutation Floor Invariant [INV-MUTATION-01]
Pull requests modifying financial ledger or balance logic must achieve >= 85.0% mutation score.
High line coverage alone cannot satisfy CI release gates without passing mutation thresholds.
Mandatory Git Diff Scoping Invariant [INV-MUTATION-02]
Pre-merge mutation testing must execute incrementally scoped to the active pull request Git diff.
Pull request pipelines exceeding the 6.0-minute execution budget fail automated performance checks.
Zero Assertion-Free Test Acceptance [INV-MUTATION-03]
Test cases that execute domain logic but kill 0% of injected mutators are flagged as assertion-free.
Pull requests containing assertion-free test suites are blocked from merging.
Explicit Unknowns
- Kotlin compiler inline function bytecode expansion impact on PITest mutant generation cardinality (G-1).
- PITest history cache synchronization contention when 30 developers open concurrent pull requests (G-2).
Traceability
| Claim | Classification | Source | Freshness |
|---|---|---|---|
| 250,000 lines of Java/Kotlin ledger code | provided | Codebase inventory intake | Current |
| Incident BUG-4102 $640k balance truncation | provided | Post-mortem incident record | Historical |
| Execution budget <= 6.0 minutes per PR | provided | Developer productivity SLA | Current |
| Mutation score threshold >= 85.0% | decided | David O'Reilly & Elena Rostova | 2026-09-15 |
| Incremental Git diff PITest scoping | decided | Architectural invariant INV-MUTATION-02 | 2026-09-15 |
| Financial mutant operator selection | decided | Core Banking Quality Standard | 2026-09-15 |
Verification
No validator was supplied, so no command was run.
Reviewer self-check against mutation testing standards:
- Efficacy Rigor: PASS. 85% mutation score floor eliminates assertion-free test illusions.
- Operator Relevance: PASS. Focused on math, boundary, negative, and return value mutations.
- Pipeline Speed: PASS. Incremental Git diff scoping keeps PR feedback under 5 minutes.
- Markdown Hygiene: PASS. Native Markdown syntax strictly adheres to
rule_markdown.md.
Open Decisions
DEC-MUTATION-01: Elena Rostova to determine whether weekly full-codebase mutation runs should be scheduled on weekend batch runners to track legacy technical debt (Owner: Elena Rostova).
Next steps
- Marcus Vance embeds the PITest Maven plugin with Git diff features into the core ledger POM configuration.
- Quality Engineering conducts baseline mutation analysis across the
calculationpackage to establish initial mutant history caches. - Enforce the 85% mutation threshold gate in GitHub Actions branch protection rules.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
What it does
This skill maps accepted code risks and a healthy test baseline into bounded experiments that alter program syntax/semantics and observe whether tests distinguish the mutant. It defines scope, operators, execution, classifications, triage and gates without selecting PIT, Stryker or mutmut.
Use it when
Use when the question is whether a test suite can detect selected plausible changes in owned executable behavior.
For example: “Our financial tax engine shows 95% line coverage, but a recent bug in progressive bracket calculations slipped into production because the tests executed the code lines without asserting exact tax output amounts.”
What you get
- Mutation Testing Spec
Written as Markdown to <your output folder>/architecture/tasks/<run-id>/mutation-testing-strategy/.
What it will not do
Do not use for ordinary unit-test design, coverage collection, static analysis, fuzzing or mutation-tool implementation.
How it works
- Check test suite baseline health.
- Define mutation scope and operator selection.
- Configure incremental execution and impacted test selection.
- Establish mutant result classification and denominator rules.
- Establish survivor triage protocols and remediation guidelines.
- Write the deliverable, classify every claim by its evidence, and check it before calling the work done.
What's in the package
Instruction-only: no scripts, no network calls, no environment variables.
- LICENSE.txt
- SKILL.md
- agents/openai.yaml
- assets/output-template-task.md
- references/domain-rules.md
- references/operating-rules.md
- references/output-contract.md
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 12 days ago
- Passed all security checks, Safe to install