MUTATION TESTING

Table of Contents

MUTATION TESTING

Following steps are used to execute mutation testing:

CLICK HERE TO READ FIRST PART

  1. Faults are introduced to the actual source code in program called mutants by creating different versions of the program each mutant should contain a single fault and the goal is to fail these mutant versions
  2. Test cases are applied to both original and mutant program, it should be adequate to find the defect or fault in the program.
  3. Comparing the results of both original and mutant program.
  4. If the original and mutant program’s results are different then the mutant is killed.
  5. If both the program generate same output then the mutant is kept alive. In these cases more effective test cases need to be created to kill mutants.

The advantages of Mutation testing

  1. It is powerful way to reach the high coverage of the source program.
  2. This testing is capable of testing the mutant program also.
  3. This testing brings a good level of error detection to the software developer. Those faults can be identified which have missed from the developer’s attention.
  4. This testing has the capacity to detect all the faults in the program and removes all the ambiguities in the source code.
  5. Customers are benefited by getting the most reliable and stable system by this testing.

The disadvantages of the Mutation Testing

  1. Mutation testing is very expensive and time consuming as there are mutant programs to be created and tested with the original program.
  2. Testing cannot be done without an automation tool.
  3. Each mutant program will have the same number of test cases as the original program has which makes the tester to test large number to mutant programs.
  4. It is not well suited for black box testing.

Questions

  1. What is Mutation Testing?
  2. Explain some examples of mutation testing?
  3. What are the characteristics of mutation testing?
  4. What is the difference between mutation testing and Happy testing?

20 Responses

  1. What is Mutation Testing?
    Mutation Testing is a type of testing technique where a certain change in the source code statement is made to check whether the test cases are able to find the error.Happy Testing is a procedure where the test users the known input and executes without any exception and produce expected output .

    Characteristics of mutation testing :
    -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.
    What is the difference between mutation testing and Happy testing?
    Mutation testing is nothing but a small change in syntactic code of original program
    statement.
    — Happy testing is a procedure where the test uses the known input and executes
    without any exception and produce expected output.
    -Increased customer satisfaction index as product would cause less bugs
    Debugging and maintaining is easy.

  2. Mutation testing is a type of testing technique where a certain change in the source code statements is made to check whether the cases are able to find the error. It is a type of white box testing which is used for unit testing

    Example of Mutant testing:
    Original program
    If(x>y)
    Print “Correct”
    Else
    Print “Incorrect”

    Mutant program
    If(x<y)
    Print "Correct"
    Else
    Print "This is wrong",

    Characteristics of Mutation testing
    -It is the most effective way to find the hidden defects in a program which is difficult to identify by the developer
    -It finds new kinds of errors and drags developers attention.
    -This testing has the capacity to detect all the faults in the program and removes all the ambiguities in the source code
    -Customer are benefitted by getting the most reliable and stable system by this testing

    Difference between Mutation testing and Happy testing
    Mutation testing is a type of software testing where we mutate certain statements in the source code and check if the test cases are able to find the errors. Happy testing is a well-defined test case using known input which executes without exception and produces an expected output.

  3. 1. Mutation testing :
    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.
    2. Examples of Mutation Testing:
    There are three types of Mutation Testing:
    a. Statement mutation: In this type some part of source code is cut and pasted by the developer.
    b.Value mutation: In this type we generally change one value to much larger value or one value to much smaller value.
    c. Decision mutation: Control statements which are used for decision making are to be changed.
    Examples:
    Original mutant program:
    if(x>y)
    print “x-y=2″;
    else
    print”y is non zero”;
    Mutant Program:
    if(x+y=10)
    print “x-y=2″;
    else
    print”y is less than zero”;

    3. Characteristics of Mitation Testing:
    – 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.
    4. Difference between Mutation testing and Happy testing:
    Mutation Testing:
    – In mutation testing some changes are made in the source code statement to check the test cases are able to find the error.
    – This is a white box testing used in unit testing.
    Happy Testing:
    – In this type of testing the test uses the known input and executes without any exception and produce expected output. The
    happy path user will understand clearly.
    – This is a black box testing used in system testing.

  4. 1) 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.

    2)Original Program Mutant Program
    If (X>Y) If (Y>X)
    Print “X = 1” Print “X=1”
    Else Else
    Print “X = 0” Print “X=0”

    3)The characteristics of mutation testing are
    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.

    4) Difference between Mutation testing and Happy testing:
    In mutation testing some changes are made in the source code statement to check the test cases are able to find the error. In happy testing the test uses the known input and executes without any exception and produce expected output.
    Mutation testing is a white box testing used in unit testing.
    Happy Testing is a black box testing used in system testing.

    5)

  5. In Mutation testing, the source code is alters called mutant/mutation to make different versions of the program and our goal is to kill these mutant. This is part of the white box testing . By doing this testing will compare original program and the mutated version, if the they both gives us different results then we killed the mutant. If both programs outcome is same then we need to make effective test cases to kill the mutant.
    Ex- Statement mutation
    Value mutation
    Decision mutation
    Difference between Mutation testing and Happy testing:
    Mutation testing the source code is altered to find our any errors in the program which achieves high programming and it helps to find out any hidden errors which are not come across developer, it helps to produce high quality and most reliable product to customer and happy testing is to test the application with know inputs to make sure the application works as we expect.It is black box testing,and Mutation testing is white box testing and very expensive and time consuming.

  6. 1) Mutation Testing brings faults to the source code and create a mutant version to see if the Test cases are strong enough to identify defects. It is also called Fault Based Testing.
    (2) In the source code, copy one line and make it duplicate, or change the primary parameter value, then create the mutant version. Apply the same inputs and same Test Cases in original and mutant version. It results of original and mutant version are the same, the mutant is alive. If the results of two version are different, the mutant is killed.
    (3) a. Fault is brought in to source code and create mutant version.
    b. Test Cases are applied to both original and mutant version.
    c. Results are compared between original and mutant version.
    d. If the result between original and mutant are different, it means mutant is killed.
    e. If the result between original and mutant are different, it means mutant is alive. More effective Test Cases have to be created.
    (4) a. Mutation Testing actually goes in source and code and makes changes, and Happy testing only works on the functionality of software.
    b. Mutant Testing starts with “fault”; it means to bring fault to source code. But Happy Testing means “default”, valid inputs, expected behavior & results from software with any exceptional

  7. Mutation testing is a type of testing technique where a certain change in the source code statements is made to check whether the cases are able to find the error. It is a type of white box testing which is used for unit testing

    Example of Mutant testing:
    Original program
    If(x>y)
    Print “Correct”
    Else
    Print “Incorrect”

    Mutant program
    If(x<y)
    Print "Correct"
    Else
    Print "This is wrong",

    Characteristics of Mutation testing
    -It is the most effective way to find the hidden defects in a program which is difficult to identify by the developer
    -It finds new kinds of errors and drags developers attention.
    -This testing has the capacity to detect all the faults in the program and removes all the ambiguities in the source code
    -Customer are benefited by getting the most reliable and stable system by this testing

    Difference between Mutation testing and Happy testing
    Mutation testing is a type of software testing where we mutate certain statements in the source code and check if the test cases are able to find the errors. Happy testing is a well-defined test case using known input which executes without exception and produces an expected output.

  8. 1) Mutation testing is a structural testing technique, which uses the structure of the code to guide the testing process. On a very high level, it is the process of rewriting the source code in small ways in order to remove the redundancies in the source code. These ambiguities might cause failures in the software if not fixed and can easily pass through testing phase undetected.

    2) Example: Example of mutation testing:
    Original code:
    if(a b)
    c = 10;
    else
    c = 20;

    3) Characteristics of MT:
    It brings a whole new kind of errors to the developer’s attention.
    It is the most powerful method to detect hidden defects, which might be impossible to identify using the conventional testing techniques.
    Tools such as Insure++ help us to find defects in the code using the state of the art.
    Increased customer satisfaction index as the product would be less buggy.
    Debugging and Maintaining the product would be more easier than ever.

    4) Difference between Mutation testing and Happy testing
    Mutation testing is a type of software testing where we mutate certain statements in the source code and check if the test cases are able to find the errors. Happy testing is a well-defined test case using known input which executes without exception and produces an expected output.

  9. 1.Mutation Testing
    where a certain change in the source code statements is made to check whether the test cases are able to find the error.A mutation is nothing but a small change in syntactic code of original program statement.
    2. some examples of mutation testing
    Original program
    If(x>y)
    Print “Hello”;
    Else
    Print “Hi”;
    Mutant program
    If(x<y)
    Print “Hello”;
    Else
    Print “How are you”;

    3.Characteristics of mutation testing
    a.It is used to find a special new kind of errors and drags developer’s attention
    b.It is most effective way to find the hidden defects in a program which is difficult to identify, by the developer.
    c.Increased customer satisfaction index as product would cause less bugs
    d.Debugging and maintaining is easy.

    4.Difference between mutation testing and Happy testing
    Mutation testing is where a certain change in the source code statements is made to check whether the test cases are able to find the error.
    Happy testing is with the valid input and executes without any exception and produce expected output is a happy testing.

  10. Mutation testing is a testing technique where a certain change in source code statement is made to check whether the test cases are able to find the error. The purpose of this technique is to check the quality of test cases which is robust enough to fail the mutant code.

    Examples are like when ever there is change in Functional specification document or adding functionalities or deleting functionalities there is some change in source code. In that cases Mutation testing is needed to check the test cases are able to find the errors.

    Characteristics:
    -It will help the developers to identify errors at white box level testing.

    Difference between Mutation and Happy testing:
    Mutation testing is a testing technique where certain change in source code statement is made to check whether the test cases are able to find the error

    Happy path testing is where the test uses known input and executes without any exception and produce expected output.

  11. 1. Mutation is a type of testing where a certain change in the source code statements is made to check whether the test cases are able to find the error. The goal is to check the quality of test cases, which is robust enough to fail the mutant code.

    2. Some examples of mutation testing include the following:
    – Statement mutation -cuts a part of the source code and pastes it somewhere else
    – Value mutation – primary parameter values are modified
    – Decision mutation – control statements that are used for decision making are changed.

    3. Characteristics of Mutation include:
    – it is used to find special errors and drag them to the developer’s attention
    – it’s the most effective way to find hidden defects, which are difficult for the developer to find on his/her own
    – it increases customer satisfaction because the product would have fewer bugs
    – debugging and maintenance is a lot easier

    4. Happy path testing is a test that uses known input and executes without any exceptions and produces the expected output. Mutation testing tests a product or software by changing the source code to identify hidden errors with the test cases.

  12. Mutation testing is a method of software testing in which program or source code is deliberately manipulated, followed by suite of testing against the mutated code. The mutations introduced to source code are designed to imitate common programming errors.

    It is also used to test the mutant program
    Quick defect detection

    Mutation testing is a structural testing approach used to check the efficiency or precision of a testing program. This method helps to check the number of defects in an application under test. Happy-path testing is a type of software testing that uses known input and produces an expected output. Also referred to as golden-path or sunny-day testing, the happy-path approach is tightly scripted. The happy path does not duplicate real-world conditions and verifies only that the required functionality is in place and functions correctly.

  13. 1.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
    2.Original program

    If(x>y)

    Print “Hello”;

    Else

    Print “Hi”;

    Mutant program

    If(x<y)

    Print “Hello”;

    Else

    Print “How are you”;
    3.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.
    4.mutation testing means the type of testing with certain changes in the source code statements to find out if the test cases is able to find errors
    Happy testing means testing the software with known inputs executed with no expectations with expected outputs

  14. 1.)Mutation Testing also known as Fault Based Testing is a type of Testing technique where certain statements in the source code are mutated or modified to check whether the test cases are able to find errors or not. It is a type of WhiteBox Testing which is used by the developers for Unit Testing.
    2.) Examples : Making changes to the program
    -> Deleting a statement.
    ->Altering an arithmetic operators.
    -> Changing the value of a constant.
    ->Changing a data type…..
    3.) It is used to find new kind of errors and drags developers attention.
    Most effective way to find the hidden defects in a prgram that are hard to identify.
    Would cause less bugs.
    Makes debugging and maintenance easier.
    4.)In Mutation Testing certain statements in the source code are mutated or modified to check whether the test cases are able to find errors or not. Happy Path Testing is a well defined test case using known input, which executes without exeption and produces an expected output.

  15. Mutation Testing also called fault-based testing is a type of Black box testing which is used for Unit Testing. In this type of testing technique, a change in the source code statements is made to check if the test cases are able to find the error. Example of Mutation Testing:
    Original Program
    If (a b)
    c = a+b;
    else
    c = a-b;
    Characteristics: By this testing, customers benefit with the most reliable and stable system. Capacity to detect the faults in the program and remove uncertainties in the source code. Developers can identify all the faults that missed their attention while coding. This is a powerful way to test the source program and mutant program too.
    Mutation Testing is a fault-based testing where a change in the source code is made to check if test case is able to find error. Test case which gives a positive result is Happy path testing.

  16. Mutation Testing also called fault-based testing is a type of Black box testing which is used for Unit Testing. In this type of testing technique, a change in the source code statements is made to check if the test cases are able to find the error.
    Example of Mutation Testing:
    Original Program
    If (a b)
    c = a+b;
    else
    c = a-b;
    Mutant Program:
    If (a > b)
    c = a+b;
    else
    c = a-b;
    Characteristics: By this testing, customers benefit with the most reliable and stable system. Capacity to detect the faults in the program and remove uncertainties in the source code. Developers can identify all the faults that missed their attention while coding. This is a powerful way to test the source program and mutant program too.
    Mutation Testing is a fault-based testing where a change in the source code is made to check if test case is able to find error. Test case which gives a positive result is Happy path testing.

  17. Mutation Testing also called fault-based testing is a type of Black box testing which is used for Unit Testing. In this type of testing technique, a change in the source code statements is made to check if the test cases are able to find the error.
    Example of Mutation Testing:
    Original Program
    If (a b)
    c = a+b;
    else
    c = a-b;
    Characteristics: By this testing, customers benefit with the most reliable and stable system. Capacity to detect the faults in the program and remove uncertainties in the source code. Developers can identify all the faults that missed their attention while coding. This is a powerful way to test the source program and mutant program too.
    Mutation Testing is a fault-based testing where a change in the source code is made to check if test case is able to find error. Test case which gives a positive result is Happy path testing.

  18. Mutation Testing is a type of testing where the source code is changed to check if the test cases can find errors. .
    Example – Original program
    If(x>y)
    Print “Hello”;
    Else
    Print “Hi”;
    Mutant program
    If(x<y)
    Print “Hello”;
    Else
    Print “How are you”;

    Characteristics –
    1. Helps find new kind of errors.
    2. It is most effective way to find the hidden defects in a program which otherwise is difficult to identify, by the developer.
    3. Increased customer satisfaction as this kind of testing reduces the number of bugs.
    4. Debugging and maintaining is easy.

    The aim of Happy Path testing is to focus only on the valid and positive inputs through which an application generates the expected output. Applications are tested on a positive flow only, with no searching for negative conditions or errors.
    Whereas in Mutation Testing, source code is intentionally changed to check for errors.

  19. Mutation Testing also called fault-based testing is a type of Black box testing which is used for Unit Testing.
    Example of Mutation Testing:
    Original Program ,If (a b), c = a+b;, else, c = a-b;
    Mutant Program:
    If (a > b)
    Difference between Mutation testing and Happy testing
    Mutation testing is a type of software testing where we mutate certain statements in the source code and check if the test cases are able to find the errors. Happy testing is a well-defined test case using known input which executes without exception and produces an expected output.

  20. Faults or mutants are introduced to the actual source to fail version by comparing the results.
    Advantages: powerful way to reach high coverage, capability for error and fault detection providing reliable and stable system some disadvantages: expensive, time consuming, needs an automation tool, not for black box testing.

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.

Share this article
Subscribe
By pressing the Subscribe button, you confirm that you have read our Privacy Policy.
Need a Free Demo Class?
Join H2K Infosys IT Online Training
Enroll Free demo class