Chapter 06: Mutation Testing Flashcards
One advantage of coverage criteria
can be measured automatically
When to stop testing?
Cumulative number of failures found so far have a “saturation effect”
2 Types of Test critera
- Coverage based: covers most specification
- Fault-based: finds most bugs
Definition: Mutation Testing
“fault based testing”
intentionally create small, syntactic changes in the code (called mutants) to simulate common mistakes.
Ex: x = a + b ➝ x = a - b
Different types of mutants?
Stillborn: syntactically incorrect and killed by compiler
trivial: killed by any test case
equivalent mutant: acts the same behavior as the oirignal program (CANNOT BE KILLED)
Killed vs. Alive mutants
If the same test cases can detect differences between a mutant and the original code then the mutant is killed.
Examples of Method-Level Mutatons?
- variable replacement
- relational operator replacement
- off-by-1
- replacement by 0
- arithmetic operator replacement
Examples of Class-Level Mutations?
- Access modifier change
- type cast change
- super keyword insertion
- method calling position change
How to calculate Mutation score?
Score = # of mutants killed / # of NON-equivalent mutants