Skip to content
Latchkey

What Is Mutation Testing?

Mutation testing evaluates how good a test suite really is by making small, deliberate changes (mutations) to the code, then running the tests to see if they fail. A surviving mutation means the tests did not catch that change, revealing a gap. It measures the effectiveness of tests, not just how many lines they touch.

Why it matters

High code coverage can hide weak assertions: a test can execute a line without checking its result. Mutation testing exposes this by asking whether the tests would actually notice if the code were broken, giving a far more honest signal of test quality than coverage alone.

Related concepts

  • More rigorous than line coverage
  • A "killed" mutant means a test caught the change
  • Computationally expensive, so often run selectively

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →