The cyclic structure has many applications in software programs, but the testing cases of the cyclic structure are relatively special. The white box testing method alone does not work. The conditional coverage method and path coverage method must be used, only when the equivalence classes in the black box testing method are divided and the boundary value analysis is combined can the problem be solved.
1. Single-Cycle Structure
Zero execution cycle
Execute the loop body once
Maximum number of execution cycles
The maximum number of execution cycles minus one
You can test the value in the middle.
2 nested loops
Set the cycle of all other layers to the minimum value from the inmost loop (excluding the inmost loop ).
Perform a simple loop test on the innermost loop. During the test, the minimum and maximum values of the loop variables that keep all Outer Loops are obtained. In addition, the cross-border value is similar to the invalid value.
Step by step, test the external layer of loops. The minimum value is used for loop variables that keep all Outer Loops during testing, and the "typical" value is used for loop variables of all other nested memory loops.
Repeat until all layers are tested cyclically.