Saturday, December 28, 2024
Google search engine
HomeGuest BlogsSoftware Testing | Mutation Testing

Software Testing | Mutation 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:

  • 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:

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 :

  • Judy
  • Jester
  • Jumble
  • PIT
  • MuClipse.

Advantages of Mutation Testing:

  • It brings a good level of error detection in the program.
  • It discovers ambiguities in the source code.
  • It finds and solves the issues of loopholes in the program.
  • It helps the testers to write or automate the better test cases.
  • It provides more efficient programming source code.

Disadvantages of Mutation Testing:

  • It is highly costly and time-consuming.
  • It is not able for Black Box Testing.
  • Some, mutations are complex and hence it is difficult to implement or run against various test cases.
  • Here, the team members who are performing the tests should have good programming knowledge.
  • Selection of correct automation tool is important to test the programs.
RELATED ARTICLES

Most Popular

Recent Comments