Table of Contents

Sources:

  1. Software Testing course at ITMO university by Kochubeev Nikolay Sergeevich

Mutation testing

Mutation testing changes the code which is being tested. For example, if a unit test checks for “1+2=3”, the mutation might change the operator, which will result in code outputting “-1”. In that case, a unit test must fail. If the unit test passes, it means it's not sufficient enough for the code.

Metric: Mutation score

Mutation score: mutations killed/total mutations.

Score 100% is very rare. 70%-80% is a good result.

Best practices

  1. You should combine code coverage with mutation testing.
  2. Focus on the most critical parts of the code like business logic.
  3. Mutation testing is slow, it's better to launch it periodically.