Saturday 17 September 2011

Mutation Testing

In structured testing, effective testing means better test coverage and more number of reported errors. This demands more number of test suites. However it is difficult to measure accuracy of test suites. The method of Mutation Testing was introduced to measure the accuracy of test suites.
In mutation testing, we perform following activities:
Step 1:  We consider a perfect program and its corresponding perfect test suite. This means, we select test suite that covers all possible and a program that passes this test suite.
Step 2: We change the code of the program. This activity is called mutating. The resulting program with this change is referred to as mutant.
Step 3: Execute test suite on mutant.
Step 4: Observe the result. If results of the program are affected by the change and test suite detects the change, then the mutant is called a ‘killed mutant’. If the results of the program do not change and the test suite does not detect the mutation, then the mutant is called an ‘equivalent mutant’.
Step 5: Continue creating more mutants and run tests using test suites. 
Step 6: Count Total Number of Mutants; Total Number of Killed Mutants
Step 7: Calculate Ratio of Total Number of Killed Mutants to Total Number of Mutants. The value arrived at provides information about accuracy of the test suite

No comments:

Post a Comment