0% found this document useful (0 votes)
127 views

Loop Testing: Dr. D. P. Mohapatra

Loop testing is an important part of software testing that helps detect bugs. There are four main types of loops: simple loops, nested loops, concatenated loops, and unstructured loops. Simple loops should be tested by bypassing the loop, checking boundary values, and typical iterations. Nested loops require a strategy of starting with the innermost loops at minimum values and working outward. Concatenated loops on the same path may or may not be independent. Unstructured loops are difficult to test and should be redesigned if possible.

Uploaded by

Hemanth Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

Loop Testing: Dr. D. P. Mohapatra

Loop testing is an important part of software testing that helps detect bugs. There are four main types of loops: simple loops, nested loops, concatenated loops, and unstructured loops. Simple loops should be tested by bypassing the loop, checking boundary values, and typical iterations. Nested loops require a strategy of starting with the innermost loops at minimum values and working outward. Concatenated loops on the same path may or may not be independent. Unstructured loops are difficult to test and should be redesigned if possible.

Uploaded by

Hemanth Kumar
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Loop Testing

Dr. D. P. Mohapatra
Loop Testing
• Loop testing viewed as an extension to
branch coverage.

* Loops are important in the software


from testing viewpoints.

* If Loops are not tested properly, bugs can


go undetected.
* Loop Testing can be done effectively in
unit testing by the developer.
Kinds of loops (Four Types)

1. Simple Loops

Figure-A Figure-B
1. Simple Loops
• Check whether you can bypass the loop or not. If the test case for
bypassing the loop is executed and, still you enter inside the loop,
it means there is a bug.
• Check whether the loop control variable is negative.
• Write one test case that executes the statements inside the loop.
• Write test cases for a typical number of iterations through the
loop.
• Write test cases for checking the boundary values of maximum &
minimum number of iterations defined (say min and max) in the
loop. It means we should test for min, min+1, min-1, max-1, max,
and max+1 number of iterations through the loop.
2. Nested Loops
Nested Loops Cont …
• When two or more loops are embedded, it is called
a nested loop.
• If we adopt the approach of simple tests to test the
nested loops, then the number of possible test cases
grows geometrically.
• The strategy is to start with the innermost loops
while holding outer loops to their minimum values.
• Continue this outward in this manner until all loops
have been covered.
3.Concatenated Loops
Concatenated Loops
• Two loops are concatenated if it is possible to reach
one after exiting the other, while still on a path from
entry to exit.
• If the two loops are not on the same path, then they
are not concatenated.
• The two loops on the same path may or may not be
independent.
• If the loop control variable for one loop is used for
another loop, then they are concatenated, but nested
loops should be treated like nested only.
4.Unstructured Loops
• This type of loop is really impractical to test
and they must be redesigned or at least
converted into simple or concatenated loops

You might also like