SWE 437 In Class Exercise # 23
Mutation Testing


Names:
Instructions: Work with your neighbors in groups. This is a mutation testing exercise. Consider the following code:
   public static int min(int a, int b) {
      int minVal;          
      minVal = a;           // 1
      if (b < a) {          // 2, 3
         minVal = b;        // 4, 5, 6, 7
      }
      return minVal;
   }
For each of the following mutations, decide whether it is
  1. minVal = b;
  2. if (b > a)
  3. if (b < minVal)
  4. Bomb();
  5. delete the statement
  6. minVal = a;
  7. minVal = failOnZero(b);

Consider the relational operator. What mutation operators make sense for relational operators? How many mutation operators are there? How many of these must be redundant (at least for weak mutation)? Students interested in a deep dive can check out the subsumption hierarchies in Gary's paper.