Mutation Testing

· 130 words · 1 minute read

Mutation testing is a technique to know how well your tests are saving you from deploying mistakes. The goal is very similar to Code Coverage, to have a metric that guide us to know how confident we can be with our code.

They differ in the way you define the metric

  • in Code Coverage you execute the tests, and check which statements where executed during the test suite execution
  • in Mutation testing, the library is going to execute the tests multiple times, but slightly changing the code.

If changing the code (possible bug) does not trigger test failure, we say the mutation survived. The metric is the number of mutations that survived.

I never tried to use this, but really eager to test how it works!

references 🔗