Skip to content

Mutation Testing

Michael Kinney edited this page Nov 30, 2026 · 1 revision

Mutation Testing

Mutation testing checks whether tests detect plausible defects. Apply it to changed decision logic and high-risk branches such as authorization, validation, money, persistence, retries and idempotency.

Procedure

  1. Run ordinary tests first; keep that baseline result.
  2. Select changed production code and meaningful dependencies. Avoid claiming whole-repository coverage from a narrow run.
  3. Use the ecosystem's maintained tool and record its pinned version, configuration, timeout and exact scope.
  4. Report killed, survived, timed-out, excluded and equivalent mutants separately.
  5. Review every survivor against a behavior requirement. Add a focused test when a survivor represents a real defect.
  6. Explain equivalent mutants and keep exclusions narrow and reviewable.
  7. Ratchet critical packages against their baseline. Use sampled/nightly runs when a complete PR run exceeds its budget, and label sampled evidence clearly.

Examples include cargo-mutants, Stryker, mutmut/Cosmic Ray and Go mutation tools. Confirm current support for the project's exact language and tool versions before requiring a tool in CI. A mutation score measures test sensitivity, not correctness.

Clone this wiki locally