Completeness of Software Testing. The Criteria for White Box. Part I

Completeness of Software Testing. The Criteria for White Box. Part I

The first criteria for white-box is a criteria of operators coverage. It demands to pick up such set of tests so that each operator in the program was executed at least once.

For example, let’s consider the following fragment of a Pascal program:

a: = 0;
if x> 3 then a: = 0;

b: = 1 / a;

In order to satisfy the criterion of operators coverage it is enough to carry out it once. Such that x was more than 3. Obviously, the software bug in this test will not be found. It manifests itself in case where x <= 3.

In order to get rid of this shortcoming, we insert a second criterion of white-box: a criterion of branch coverage (criterion of decisions coverage). It demands to pick up such set of tests to each branch in the program was carried out at least once. Software testing in terms of this criterion detects an error in the previous example.

Let’s consider another example, in Pascal it would look like this:

a: = 7;
while a <x do a: = a-1;
b: = 1 / a;

In order to satisfy the criterion of branch coverage in this case it is enough only one test. For example such that x was equal to 6 or 5. All branches will be completed. But an error in the program will not be found. It will manifest itself in one case when x = 0. But criterion of branch coverage does not require such a test from us.

In order to take into account this fact we insert a third criterion of white-box: a criterion for paths coverage. It demands to pick up such set of tests that every path in the program was executed at least once. Testing in terms of this criterion would reveal an error in the second example, but how many ways is it possible in the second example? Infinitely many! There is a need in some more compromise criterion. It should be more stringent than branches coverage, but less stringent than paths covering.

Knowledge Center
Knowledge Center
Subscribe

*- required fields