tdd-mutation
TDD + Mutation
The Iron Law: No production code without a failing test first. The Quality Law: No "done" without a mutation score that proves the tests bite.
Violating the letter of these rules violates the spirit. If you are negotiating with the rules, you are rationalizing.
Why both halves
TDD without mutation testing is half the loop. Coverage proves a line ran. A passing test suite proves nothing about whether your tests would notice a bug — many tests assert that a value is "truthy" or that a method "was called" and pass for any plausible-looking output.
Mutation testing closes the loop. Tools (or you, by hand) introduce small bugs into the code, run the tests, and report which bugs the tests failed to detect. Every surviving mutant is a missing assertion. Under strict TDD, mutation kill rate is high without effort, because every line was demanded by a test. Under loose TDD, mutation testing exposes the gap.
One discipline, two gates:
- RED → GREEN → REFACTOR (you wrote the right code).
- Mutate → kill → strengthen (your tests would catch it if you didn't).