All IT Courses 50% Off
QA Tutorials

Mutation Testing

Mutation testing is a type of white box testing method where we insert errors intentionally to verify whether the existing test case can defect the error or not. Here the mutant of the program which is some modification to the original program. The main objective of mutation testing is to check whether each mutant creates an output where it means that it is different from the output of the original program. We will make some modifications in the mutant program because if we change it on a massive scale, then it will affect the overall plan.

Mutation testing aim is to evaluate the quality of the case that should be able to fail the mutant code so this method is called as Fault-based testing as it produces the errors within the program and that  we can say that mutation testing is performed to see check the efficiency of the test cases.

What is mutation?

Mutation may be small modification within the program. These minor modifications are planned to typical low level which happens at the coding time. We deliberate the mutation operators in the form of rules which match the data and also generate some efficient environment to produce the mutant.

All IT Courses 50% Off

Types of mutation testing?

This testing can be classified as

  • Decision mutations
  • Value mutations
  • Statement mutations
Mutation Testing
  1. Decision Mutation- This type of mutation testing will check the design errors. Here we will do the modification in arithmetic and logical operator to detect errors in the program.

Like if we do the changes in arithmetic operators

  • Plus(+)-> Minus(-)
  • asterisk(*)-> double asterisk(*)
  • plus(+)-> incremental operator(i++)

For example : we do  changes in the logical operators

Exchange p> -> p<, OR p >=

example 

original codemodified code
If (p>q)      
 r=5;
else       
r=15;
if(p<q)     
r=5;
else   
  r=15;
  1. Value Mutations- The values will modify to identify the errors in the program and generally we will change the following

Smaller value to a higher value 

Higher value to a smaller value.

For example:

Original codeModified code
int add =9000008
int p = 65432;
int q = 12345;
int r = (p+q);
int mod = 9008;
int p = 65432;
int q = 12345;
int r = (p+q);
  1. Statement mutation- it means that we can do the modifications into statements by removing or replacing the line as we see in the following example
Mutation Testing

How to do mutation testing?

Mutation Testing

Here we will add errors into the code of the program by producing many versions, known as mutants. Here every mutant having one error leads to the mutant kinds unsuccessful and also validates the efficiency of the test cases. Then we will take the help of the test cases in the mutant program and actual application will find the errors in the code. When we identify the faults, we will match the output of the actual code and mutant code. Lastly comparing the output of both actual and mutant programs, if the results are not matched, then the mutant is executed by the test cases. Therefore, the test case has to be sufficient for identifying the modification between the actual programs.

Advantages:

The benefits are:

  • It approaches right for error detection to the application programmer.
  • Mutation testing is an excellent method to achieve the extensive coverage of the source program.
  • Mutation testing helps us to give the most established and dependable structure for the clients.

Disadvantages:

The drawbacks are:

  • This testing is bit time taking and costlier process because we have many mutant programs which need to be created.
  • This mutation testing is not appropriate for black box testing it includes the modification in the source code.
Facebook Comments

10 Comments

  1. Mutation testing is a type of white box testing , it is testing at source code level by inducing errors. This is not applicable for Black box testing as it requires changes to source code.

  2. Mutation testing is a white box testing that finds the usefulness of existing test cases & test data. Mutation testing is a changed copy of the original program where both outcomes are the same.

  3. Mutation Testing
    In my understanding of mutation testing is purposely inserting error to verify whether the existing test case can defect the error or not. The main objective of mutation testing is to check whether each mutant creates an output where it means that it is different from the output of the original program. There are three types of mutant testing
    • Decision mutations- This type of mutation testing will check the design errors.
    • Value mutations- The values will modify to identify the errors in the program.
    • Statement mutations – it means that we can do the modifications into statements by removing or replacing the line.

  4. Mutation Testing is done by modifying the original program. Very small changes are made. Mutation testing aim is to evaluate the quality of the case that should be able to fail the mutant code so this method is called as Fault-based testing. Types of testing are Decision, Value and Statement testing. This type of testing is an excellent method to achieve the extensive coverage of the source program but is it quite time consuming and a lot of cost is added to it.

  5. Mutation Testing
    Mutation testing is a type of white box testing method where we insert errors intentionally to verify whether the existing test case can defect the error or not. The main objective of mutation testing is to check whether each mutant creates an output of the original program.
    There are three types of Mutation Testing:
    • Decision mutations- This type of mutation testing will check the design errors. Here we will do the modification in arithmetic and logical operator to detect errors in the program.
    • Value mutations – The values will modify to identify the errors in the program.
    • Statement mutations- It means that we can do the modifications into statements by removing or replacing the line.
    Advantage:
    • t approaches right for error detection to the application programmer.
    • Mutation testing is an excellent method to achieve the extensive coverage of the source program.
    • Mutation testing helps us to give the most established and dependable structure for the client
    Dis-advantage-

    • This testing is bit time taking and costlier process because we have many mutant programs which need to be created.
    • This mutation testing is not appropriate for black box testing it includes the modification in the source code.

  6. Mutation Testing:
    It is a type of white box testing to evaluate the quality of the testing. The main point of mutation testing is to show whether the tests are able to detect subtle errors that might be created in future. Mutation frameworks take the original source code and introduce some modifications to it, named as mutation. Then unit tests are run against both the original code and mutated one and results are compared. If all test pass after mutation, that means mutation survived. On the other hand, if one or more tests fail after mutation, means there is no error in the code, the Mutation version was killed.

  7. Mutation testing is a type of white box testing method where we insert errors intentionally to verify whether the existing test case can detect an error or not. Mutation may be small modification within the program. Mutation testing aim is to improve the quality of the test . This method is also called Fault-based testing .

  8. Mutatio testing is the method of evaluvating the test quality by injecting the bug into code and see whether the test detecting the fault or not.There are 3 types of mutatio testing
    1. decision mutation
    2. value mutation
    3. statement mutation

  9. 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.

    Mutation testing aim is to improve the quality of the test. This method is also called Fault-based testing.
    There are 3 types of mutation testing
    1. Decision mutation
    2. Value mutation
    3. Statement mutation

  10. Mutation testing is a type of white box testing method where we insert errors intentionally to verify whether the existing test case can defect the error or not. Here the mutant of the program which is some modification to the original program. The main objective of mutation testing is to check whether each mutant creates an output where it means that it is different from the output of the original program. We will make some modifications in the mutant program because if we change it on a massive scale, then it will affect the overall plan.

    Mutation testing aim is to evaluate the quality of the case that should be able to fail the mutant code so this method is called as Fault-based testing as it produces the errors within the program and that we can say that mutation testing is performed to see check the efficiency of the test cases.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Articles

Back to top button
H2kinfosys Free Demo Online Training