Lecture 4-Mutation Testing Flashcards
What is mutation testing and what does it do?
-It’s a fault-based testing: directed towards typical faults that could occur in a program.
-Modify (MUTATE) some statements in the code, so we have many different versions of the code. EACH VERSION IS A BUG.
How do we know if the mutant Is killed or alive ?
-Mutant is killed if: different results are found, the test case is good as it detects the change.
-Mutant is alive if: the results are the same. test is NOT effective.
What are the two reasons why a mutant remains live?
- It’s equivalent to the original program
-The test case is inadequate to kill the mutant
How should mutation testing be used?
In conjunction with traditional testing techniques, NOT INSTEAD OF THEM.
What are mutation operators used for?
For the automated generation of mutants
What are 3 examples of mutants?
Stillborn mutant: syntactically incorrect, killed by compiler
Trivial mutant: killed by almost any test case
-Equivalent mutant: always produces the same output as the original program
What is the competent programmer assumption?
A programmer develops a program that is either correct or differs from the correct program by a combination of simple errors.
What is the coupling effect assumption?
Complex faults are coupled to simple faults in such a way that a test data set that detects all simple faults in a program will detect a high percentage of the complex faults.
What is complete coverage in mutation coverage ?
It equates to killing ALL non-equivalent mutants
What is mutation score?
-The amount of coverage
-Ratio of dead mutants over all non-equivalent mutants:
100 * dead mutants/(number of mutants - equivalent mutants)
-A set of test cases is mutation adequate if its mutation score is 100%
-NUMBER OF MUTANTS TENDS TO BE LARGE EVEN FOR SMALL PROGRAMS
Strong vs weak mutation
Strong:
-A fault must be reachable
-Infect the state
-Propagate to output
Weak:
-A fault must be reachable
-Infect the state
* They require almost the same number of test cases to satisfy them
Define strongly killing mutants
If: m is mutant, p is program and t is test case:
it is said to strongly kill m if the output of t/p is different from t/m.
What is strong mutation coverage (SMC) ?
For each mutant m in M, TR contain a test case which strongly kills m.
Define weakly killing mutants
If : m is mutant , l is source location, p is program and t is test :
t is said to weakly kill m if the STATE of the execution of p/t is different from the STATE of execution of m/t, immediately after some execution of L.
What is weak mutation coverage (WMC)?
For each mutant m in M, TR contains a test case which weakly kills m.