Most faults are simple mistakes 2. Coupling Effects • Simple faults are coupled to complex faults • Fixing simple faults will fix complex faults • Tests that detect mutants would also detect real bugs Two Hypotheses
class 2. Create mutant class - change one aspect 3. Test mutant class 4. Compare test results “Open Box” testing - knows about internals Mutation testing R. Lipton, “Fault Diagnosis of Computer Programs”, Student Report, Carnegie Mellon University, 1971
covered by test case Mutant Survived • Changing code did not break test • Mutant is not covered by test case, or • Mutant is equivalent to original class Mutation Testing
survivors Suppress equivalents Calculate mutation score • Indicator of test quality Fix tests • Ensure original code is still green Evaluating, or Counting the Bodies killed mutants total mutants Mutation Score * 100
as well as hand crafted Constants are less helpful than expected • Tests typically reference production values Removing DML didn’t break tests • Tendency to check returned value over database contents Key Learnings
potential mutants Measurable mutation score Manual verification of surviving mutants Improve test suite quality Full test run for each mutant Tests how the code doesn’t work Knowledge of code internals required