Unit 7
Unit 7
Fault-Based Testing
Mr.Sandeep kumar S
Assistant Professor
Dept. Of. CSE, MITE
• If many mutants are killed, infer that the test suite is also
effective at finding real bugs
Step 1: Faults are introduced into the source code of the program by
creating many versions called mutants. Each mutant should contain a
single fault, and the goal is to cause the mutant version to fail which
demonstrates the effectiveness of the test cases.
Step 2: Test cases are applied to the original program and also to the
mutant program. A test case should be adequate, and it is tweaked to
detect faults in a program.
Step 3: Compare the results of original and mutant program.
Step 4: If the original program and mutant programs generate the same
output, then that the mutant is killed by the test case. Hence the test
case is good enough to detect the change between the original and the
mutant program.
Step 5: If the original program and mutant program generate different
output, Mutant is kept alive. In such cases , more effective test cases
need to be created that kill all mutants.
•adding test data M=2, N=1 will eliminate the latter live mutant, but the former
live mutant remains live because it is equivalent to the original function. No test
data can eliminate it.
Advantages of Mutation Testing:
• It is a powerful approach to attain high coverage of the source
program.
• This testing is capable comprehensively testing the mutant
program.
• Mutation testing brings a good level of error detection to the
software developer.
• This method uncovers ambiguities in the source code, and has the
capacity to detect all the faults in the program.
• Customers are benefited from this testing by getting most reliable
and stable system.
• Since its time consuming, it’s fair to say that this testing cannot
be done without an automation tool.
• Each mutation will have the same number of test cases than that
of the original program. So, a large number of mutant programs
may need to be tested against the original test suite.
2.Generate mutants
3.Distinguish mutants
• Test stubs
– Substitute for called functions/methods/objects
• Test harness
– Substitutes for other parts of the deployed
environment
• Ex: Software simulation of a hardware device
Program Functionality