How-to guide

How to investigate a surviving mutant

What should I do when a mutant survives a test suite?

Inspect the changed behaviour and ask which valid input would distinguish it from the original. If the difference matters, add an independently justified expectation, then run it against both versions and retain the result for that mutant.

Work from the changed decision

A survivor is a clue. A missed input, a weak assertion, an unreachable path and an equivalent change each need different treatment.

  1. Read the change and identify its possible user-visible effect. Check whether the selected tests actually reached it.
  2. Find the smallest distinguishing example. If the implementations are equivalent under the stated domain, document the reasoning for review.
  3. Run the improved check against the original and altered versions. Confirm the original passes and the altered behaviour makes the intended assertion fail.

Worked example

A packing fee starts at six items

A mutant changes ‘six or more’ to ‘more than six’. Cases with five and seven items pass against both versions. Add an order of exactly six and assert the fee from the published rule. The mutant is detected when that assertion reports the missing fee.

Try it on your pull request

Choose a change in your repository and tell Cue April what should happen. Review the proposed checks before they run.

Try Cue April on your repository