SWE 437 In Class Exercise # 25
More Mutation Testing


Names:
Instructions: Work with your neighbors in groups. This is a mutation exercise. Consider (again) the following code:
public final class GoodFastCheap {

    // boolean variables good, fast, and cheap
    // other stuff omitted

    public boolean isSatisfactory() {
       if ((good && fast) || (good && cheap) || (fast && cheap)) {
          return true;
       }
       return false;
    }

    public boolean isSatisfactoryRefactored() {
       if (good && fast)  return true;
       if (good && cheap) return true;
       if (fast && cheap) return true;
       return false;
    }
}
Consider two mutation operators, one that replaces boolean variables with the constant "true", and another that replaces boolean variables with the constant "false".
  1. How many mutants do these two operators generate for
    • isSatisfactory()?
    • isSatisfactoryRefactored()?


  2. Are any of these mutants "equivalent"? What is it about these mutation operators that makes this analysis especially easy?

  3. Some of these mutants are bound to be redundant. How many? Why?

  4. Consider a pair of corresponding mutants, one in each method. Will these mutants be killed by exactly the same tests? Is this a good thing?

  5. For each mutant, find all the tests that kill that mutant.