Mutation testing measures…
Options
- The execution speed of the code under test
- Test quality: it plants bugs and expects failures (Correct option)
- The memory usage of the code during a run
- How often the code changes in the repository
Answer
How good your tests are: it injects small bugs (mutants) into the code and checks whether tests fail
Why
The tool makes small changes to your code, for example > into >= or + into -, and runs your tests for each change.
If the tests still pass with the bug in place, that mutant 'survived', meaning your tests do not really check that behavior.
It is slow, so it is typically run on important modules. Tools: mutmut (Python), Stryker (JS).
Remember
Mutation testing = do my tests catch deliberately planted bugs?