How to perform mutation testing?

| | 1 min read

Mutation testing is a type of white box testing in which we mutate certain statement in the source code inorder to identify the effectiveness of the test case. A mutation is a small change in a program. It is a type of unit testing, the changes in the source code will be small so that it does not affect the objective of the program.

To execute mutation testing, first of all maintain a copy of original program then introduce fault in the source code so that original program will become mutant program. The test cases are applied to original program and mutant program. Then compare the result of the original program and mutant program. If the output generated by both programs are same then mutant is killed by the test case. Hence is the test case is efficient.On the other hand if the output generated by both programs are different then mutant program will be kept alive and effective test case will be created it kill all the mutant.

The ultimate goal of Mutation Testing is to identify the quality of the test cases which should be robust enough to fail mutant code. It is also called as Fault based testing strategy as it involves creating fault in the program. Hope this article helps you to understand mutation testing.