What is mutation testing?

Answer

Mutation testing evaluates the quality of a test suite by intentionally introducing small bugs (mutations) into the production code and checking whether the tests catch them. A mutant is a modified version of the code. If tests fail when a mutant is introduced, the mutant is "killed" (good). If tests still pass, the mutant "survives" (bad — your tests aren't catching this type of defect). Common mutations: changing + to -, > to >=, true to false, removing method calls, changing return values. Mutation score = (killed mutants / total mutants) × 100%. A high mutation score indicates tests are actually catching bugs. Tools: Stryker (JavaScript/.NET), PIT/Pitest (Java), mutmut (Python), Infection (PHP). Mutation testing is the gold standard for test suite quality — far more meaningful than code coverage. Downside: computationally expensive (generates and tests many mutants).