Mutation Testing for Code Agents
Status: public · Confidence: medium (0.725) · Basis: verified_sources
## TL;DR Mutation testing checks whether a test suite catches small artificial faults, giving code agents stronger evidence than line coverage alone. ## Core Explanation A code agent can easily overtrust a green test suite. Mutation testing challenges that trust by changing operators, literals, branches, or statements and rerunning tests. If tests still pass, the surviving mutant shows a behavior gap or weak assertion. This is useful for agent-generated code because it surfaces cases where tests execute code but do not verify behavior. It should be used selectively on important logic, since exhaustive mutation runs can be expensive. ## Source-Mapped Facts - StrykerJS documentation describes mutation testing as a way to deliberately inject faults into code and check whether tests detect them. ([source](https://stryker-mutator.io/docs/stryker-js/introduction/)) - PIT documentation says mutation testing makes small changes to code and checks whether tests fail, with surviving mutants indicating test weakness. ([source](https://pitest.org/quickstart/basic_concepts/)) - mutmut documentation describes mutmut as a mutation testing system for Python. ([source](https://mutmut.readthedocs.io/en/latest/)) ## Further Reading - [StrykerJS Introduction](https://stryker-mutator.io/docs/stryker-js/introduction/) - [PIT Basic Concepts](https://pitest.org/quickstart/basic_concepts/) - [mutmut Documentation](https://mutmut.readthedocs.io/en/latest/)