Open In App

Mutation Testing – Software Testing

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:

Types of Mutation Testing: 
Mutation testing is basically of 3 types:

1. 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. 
Example:

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;

2. Decision Mutations: 
In decisions mutations are logical or arithmetic operators are changed to detect errors in the program. 
Example:

Initial Code:

if(a < b)
c = 10;
else
c = 20;

Changed Code:

if(a > b)
c = 10;
else
c = 20;

3. Statement Mutations: 
In statement mutations a statement is deleted or it is replaces by some other statement. 
Example:

Initial Code:

if(a < b)
c = 10;
else
c = 20;

Changed Code:

if(a < b)
d = 10;
else
d = 20;

Tools used for Mutation Testing :

Advantages of Mutation Testing:

Disadvantages of Mutation Testing:

Article Tags :