What is mutation testing?
Mutation testing is a white box method in software testing where we insert errors purposely into a program (under test) to verify whether the existing test case can detect the error or not. In this testing, the mutant of the program is created by making some modifications to the original program.
The primary objective of mutation testing is to check whether each mutant created an output, which means that it is different from the output of the original program. We will make slight modifications in the mutant program because if we change it on a massive scale than it will affect the overall plan.
When we detected the number of errors, it implies that either the program is correct or the test case is inefficient to identify the fault.
Mutation testing purposes is to evaluate the quality of the case that should be able to fail the mutant code hence this method is also known as Fault-based testing as it used to produce an error in the program and that why we can say that the mutation testing is performed to check the efficiency of the test cases.
What is mutation?
The mutation is a small modification in a program; these minor modifications are planned to typical low-level errors which are happened at the time of coding process.
Generally, we deliberate the mutation operators in the form of rules which match the data and also generate some efficient environment to produce the mutant.
Types of mutation testing
Mutation testing can be classified into three parts, which are as follows:
Let us understand them one by one:
In this type of mutation testing, we will check the design errors. And here, we will do the modification in arithmetic and logical operator to detect the errors in the program.
Like if we do the following changes in arithmetic operators:
Like if we do the following changes in logical operators
Now, let see one example for our better understanding:
In this, the values will modify to identify the errors in the program, and generally, we will change the following:
Statement mutations means that we can do the modifications into the statements by removing or replacing the line as we see in the below example:
In the above case, we have replaced the statement r=15 by s=15, and r=25 by s=25.
How to perform mutation testing
To perform mutation testing, we will follow the below process:
Advantages and disadvantages of Mutation Testing
The benefits of mutation testing are as follows:
The drawbacks of mutant testing are as follows: