Mutation testing (sometimes also called mutation analysis) is a method of software testing, which involves modifying program’s source code in small ways. These, so-called mutations, are based on well-defined mutation operators that either mimic typical user mistakes (such as using the wrong operator or variable name) or force the creation of valuable tests (such as driving each expression to zero). The purpose is to help the tester develop effective tests or locate weaknesses in the test data used for the program or in sections of the code that are seldom or never accessed during execution.
Pioneered in the 1970s, mutation testing was originally intended to locate and expose weaknesses in test suites. The theory was that if a mutation was introduced without the behavior (generally output) of the program being affected, this indicated either that the code that had been mutated was never executed (redundant code) or that the testing suite was unable to locate the fault. In order for this to function at any scale, a large number of mutations had to be introduced into a large program, leading to the compilation and execution of an extremely large number
of copies of the program. This problem of the expense of mutation testing, has reduced its practical use as a method of software testing.
Mutation testing is done by selecting a set of mutation operators and then applying them to the source program one at a time for each applicable piece of the source code. The result of applying of one mutation operator to the program is called a mutant. If the test suite is able to detect the change (i.e. one of tests fails), then mutant is said to be killed.
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.