Pattern: Mutation Testing

Intent

Also Known As

Motivation

It's really hard to understand how good a given set of tests is. A common sense observation says that a test is good if even slight change in program functionality (regression) leads to a test failure. In mutation testing the original program source code is being changed (mutated) somehow and tests are run. After many different mutations introduced a resulting tests failure rate might be considered as useful test quality metrics.

Code mutations can also be used for finding new, untested cases of functionality.

While doing random mutations is possible, many tools perform much simpler ones, but apply them consistently over large code base. Possible mutations might include:

Applicability

Example

Related Patterns

Related Antipatterns

References

ToDo