Mutation Testing and Error Seeding-White Box Testing Techniques
Error seeding and mutation testing are both error-oriented techniques and are generally, applicable to all levels of testing.
Error Seeding Technique:
In error-seeding technique, a predefined number of artificially generated errors is “sown” in the program code. After that, test runs are used to detect errors and to examine the ratio between actual and artificial errors based on the total number of detected errors. The testers do not know the artificially generated errors.
Broad Comparison among these two techniques of white-box testing are as under
Error Seeding | Mutation Testing | |
1 | No mutants are present here. | Mutants are developed for testing. |
2 | Here source code is tested within itself. | Here mutants are combined, compared for testing to find error introduced. |
3 | Errors are introduced directly. | Special techniques are used to introduce errors. |
4 | Test cases which detect errors are used for testing. | Here, test cases which kill mutants are used for testing. |
5 | It is less efficient error testing technique. | It is more efficient than error seeding. |
6 | It requires less time. | It is more time consuming. |
7 | It is economical to perform. | It is expensive to perform. |
8 | It is better method for bigger problems. | It is a better method for small size programs. |
Mutation testing Technique:
De Millo proposed the mutation-testing scheme in 1978. In this testing technique, we mutate or change certain statements in the source code and check if the test code is able to find the errors. It is a technique that is used to assess the quality of the test cases i.e., whether they can reveal certain types of faults.
For example, SDLC is viewed as a “root-finding” procedure. That is, a designer submits an initial guess, which is then iteratively tested for validity until a correct solution is obtained. This is the principle of Meta-Induction.
These mutants are run with an input data from a given test set. If a test set can distinguish a mutant from the original program i.e., it produces different execution result, the mutant is said to be killed. Otherwise, the mutant is called as a live mutant.
A mutant remains live because it is equivalent to the original program i.e., it is functionally identical to the original program or the test data is inadequate to kill the mutant. If a test data is inadequate, it can be improved by adding test cases to kill the live mutant. A test set which can kill all non-equivalent mutants is said to be adequate (mutation score).
How to measure the adequacy of a test set?
Adequacy of test set = (No. of killed mutants) / (No. of non-equivalent mutants)
Advantages of Mutation Testing
1)It can show the ambiguities in code.
2) It leads to move reliable product.
3) A comprehensive testing can be done.
Disadvantages of Mutation Testing
1) It is difficult to identify and kill equivalent mutants.
2) Stubborn mutants are difficult to kill.
3) It is time consuming technique, hence requires automated tools.
4) Each mutation will have the same size as that of the original program. So, a large number of mutant programs may need to be tested against the candidate test suite.
Many more Articles & Tutorials on White Box Testing
An expert on R&D, Online Training and Publishing. He is M.Tech. (Honours) and is a part of the STG team since inception.
Thanks!! this was useful..