Loop Testing
• Loop Testing is a type of Software Testing type that is
performed to validate the loops.
• It is one of the type of Control Structure Testing.
• Loop testing is a white box testing technique and is used
to test loops in the program.
Objectives of Loop Testing:
• To fix the infinite loop repetition problem.
• To know the performance.
• To identify the loop initialization problems.
• To determine the uninitialized variables.
Types of Loop Testing:
•
Loop testing is classified on the basis of the types of the
loops:
• Simple Loop Testing
• Nested Loop Testing
• Concatenated Loop Testing
• Unstructured Loop Testing
• Simple Loop Testing:
Testing performed in a simple loop is known as Simple
loop testing. Simple loop is basically a normal “for”,
“while” or “do-while” in which a condition is given and
loop runs and terminates according to true and false
occurrence of the condition respectively. This type of
testing is performed basically to test the condition of the
loop whether the condition is sufficient to terminate loop
after some point of time.
While (condition 1) statements
Nested Loop Testing
• Testing performed in a nested loop in known as Nested
loop testing. Nested loop is basically one loop inside the
another loop. In nested loop there can be finite number of
loops inside a loop and there a nest is made. It may be
either of any of three loops i.e., for, while or do-while.
while(condition 1) { while(condition 2) { statement(s); } }
Concatenated Loop Testing:
• Testing performed in a concatenated loop is known as
Concatenated loop testing. It is performed on the
concatenated loops. Concatenated loops are loops after
the loop. It is a series of loops. Difference between nested
and concatenated is that in nested loop is inside the loop
but here loop is after the loop.
while(condition 1) { statement(s);
}
while(condition 2) { statement(s);
}
Unstructured Loop Testing:
• Testing performed in an unstructured loop is known as
Unstructured loop testing. Unstructured loop is the
combination of nested and concatenated loops. It is
basically a group of loops that are in no order.
while() { for() {} while() {} }
Advantages of Loop Testing:
• The advantages of Loop testing are:
• Loop testing limits the number of iterations of loop.
• Loop testing ensures that program doesn’t go into infinite
loop process.
• Loop testing endures initialization of every used variable
inside the loop.
• Loop testing helps in identification of different problems
inside the loop.
• Loop testing helps in determination of capacity.
• Disadvantages of Loop Testing:
The disadvantages of Loop testing are:
• Loop testing is mostly effective in bug detection in low-
level software.
• Loop testing is not useful in bug detection.