Mutation testing is a type of testing technique where a certain change in the source code statements is made to check whether the test cases are able to find the error. It is a type of white box testing which is used for unit testing. The goal or purpose of this testing is to check the quality of test cases which is robust enough to fail the mutant code. It is also called as fault based testing.
Types of mutation testing:
- Statement mutation: Some part of source code is cut and pasted by the developer, that is changes are done by deleting or duplicating the line, which may be to find fault.
- Value mutation: Primary parameter values are modified. We usually change one value to much larger value or one value to much smaller value.
- Decision mutation: Control statements which are used for decision making are to be changed. The conditions are checked for design errors. For example: one change in arithmetic operators to locate the defects and also consider mutating the relational operators and logical operators.
How mutant program is created
A mutation is nothing but a small change in syntactic code of original program statement.
Print “How are you”;
Mutation testing benefits:
- It is used to find a special new kind of errors and drags developer’s attention
- It is most effective way to find the hidden defects in a program which is difficult to identify, by the developer.
- Increased customer satisfaction index as product would cause less bugs
- Debugging and maintaining is easy.
How to do mutation testing