Description of the method
Task 1
section 9.3.1, part 1. Translate the below text and delete the picture
Task 2
section 9.3.1, part 2. Translate the below text and delete the picture
Task 3
section 9.3.1, part 3. Translate the below text and delete the picture
The error hypothesis states that errors can occur due to a specific control flow, determined by decisions made in decision instructions. Let's consider the following simple example from listing 9.2.
1 x:=0;
2 if (a>b) then
3 x:=x+1
4 endif
5 y:=100/x
Listing 9.2. A simple program
Assuming values of a and b such that a > b will cause instructions 1, 2, 3, 4, 5 to be executed and will result in full instruction coverage of this fragment. However, note that if instruction 3 is not executed, the variable x will retain a value of 0, and in line 5, we divide by x. Division by 0 is not allowed and performing such an operation may result in a crash or unexpected behavior of the program or operating system. By applying the instruction coverage criterion, we might not foresee testing the program in this way. However, these situations can be verified using the decision coverage criterion. It requires the existence of at least one test case in which the predicate in line 2 has a false value. This causes division by 0 in line 5 and a crash.
Test conditions in this method are basic blocks containing decisions, such as if, for, while, switch-case instructions, etc. For a given test condition, the coverage elements are all possible logical values (true and false) that the decision corresponding to that condition can take. If the program does not contain branches, the test conditions and coverage elements are instructions, just as in the instruction coverage criterion.
Table 9.6 summarizes the decision testing method.
Task 4
section 9.3.1, part 4. Translate the below text and delete the picture