Introduction
This article explains Control Structure Testing and Loop Testing. Control Structure Testing is a part of white box testing, it includes the following methods:
- Condition Testing
- Loop Testing
- Data validation testing
- Path testing
Here I am explaining Loop Testing.
Loop Testing
Loops are fundamental for the vast majority of all algorithms implemented in software. Loop Testing is a white box testing technique that entirely concentrates on the validity of loop constructs.
Types of Loops
Loops are of the following four types:
- Simple Loop
- Nested Loops
- Concatenated Loops
- Unstructured Loops
Simple Loops
A simple loop is tested in the following way:
- Skip the entire loop.
- Make 1 pass through the loop.
- Make 2 passes through the loop.
- Make x passes through the loop where x<y, n is the maximum number of passes through the loop.
- Make "y","y-1","y+1" passes throug the loop where "y" is the maximum number of allowable passes through the loop.
Nested Loop
A nested loop is tested in the following way:
- A nested loop starts at the innermost loop.
- For the innermost loop, conduct a simple loop test.
- Work outward.
- Continue until the outermost loop has been tested.
Concatenated Loops
To test concatenated loops the procedure is:
If the loops are independent then test them as simple loops or else test them as nested loops.
Unstructured Loops
These are unstructured loops. To test them one needs to restructure the design to reflect the use of the structured programming constructs.