Mutation Testing is a type of Software Testing that is performed to design new software tests and also evaluate the quality of already existing software tests. Mutation testing is related to modification a program in small ways. It focuses to help the tester develop effective tests or locate weaknesses in the test data used for the program.
History of Mutation Testing:
Richard Lipton proposed the mutation testing in 1971 for the first time. Although high cost reduced the use of mutation testing but now it is widely used for languages such as Java and XML.
Mutation Testing is a White Box Testing.
Mutation testing can be applied to design models, specifications, databases, tests, and XML. It is a structural testing technique, which uses the structure of the code to guide the testing process. It can be described as the process of rewriting the source code in small ways in order to remove the redundancies in the source code.
Objective of Mutation Testing:
The objective of mutation testing is:
- To identify pieces of code that are not tested properly.
- To identify hidden defects that can’t be detected using other testing methods.
- To discover new kinds of errors or bugs.
- To calculate the mutation score.
- To study error propagation and state infection in the program.
- To assess the quality of the test cases.
Types of Mutation Testing:
Mutation testing is basically of 3 types:
- Value Mutations:
In this type of testing the values are changed to detect errors in the program. Basically a small value is changed to a larger value or a larger value is changed to a smaller value. In this testing basically constants are changed.
Initial Code: int mod = 1000000007; int a = 12345678; int b = 98765432; int c = (a + b) % mod; Changed Code: int mod = 1007; int a = 12345678; int b = 98765432; int c = (a + b) % mod;
- Decision Mutations:
In decisions mutations are logical or arithmetic operators are changed to detect errors in the program.
Initial Code: if(a < b) c = 10; else c = 20; Changed Code: if(a > b) c = 10; else c = 20;
- Statement Mutations:
In statement mutations a statement is deleted or it is replaces by some other statement.
Initial Code: if(a < b) c = 10; else c = 20; Changed Code: if(a < b) d = 10; else d = 20;
Advantages of Mutation Testing:
- It brings a good level of error detection in the program.
- It discovers ambiguities in the source code.
Disadvantages of Mutation Testing:
- It is highly costly and time-consuming.
- It is not able for Black Box Testing.
GeeksforGeeks has prepared a complete interview preparation course with premium videos, theory, practice problems, TA support and many more features. Please refer Placement 100 for details
- Software Engineering | Differences between Sanity Testing and Smoke Testing
- Software Engineering | Comparison between Regression Testing and Re-Testing
- Object Oriented Testing in Software Testing
- Difference between Software Testing and Embedded Testing
- Software Testing | Security Testing
- Alpha Testing | Software Testing
- Software Testing | Penetration Testing
- Software Testing | Portability Testing
- Sandwich Testing | Software Testing
- Software Testing | Configuration Testing
- Software Testing | Use Case Testing
- Software Testing | Globalization Testing
- Software Testing | Fuzz Testing
- Software Testing | Stability Testing
- Pilot Testing in Software Testing
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.