Loop testing is also one of the white box testing techniques and thus requires a very deep knowledge about the software system or application. Loop testing methodology has been designed exclusively for the checking of the validation of the iterative constructs which are nothing but the loops.
Types of Loop Constructs
These loop constructs are 4 types as mentioned below:
1. Unstructured loops
2. Simple loops
3. Nested loops and
4. Concatenated loops
Tests applied to different Loop Constructs
Now we shall define some of the tests that can be applied to the above mentioned types of loop constructs under the context of the loop testing:
1. For unstructured loops only one thing is possible which is that they should be redesigned in order to form a structured construct and then can be tested accordingly.
2. For simple loops a number of allowable passes through them is specified first and then the following tests are applied:
(a) Skipping of the entire loop.
(b) Making only one pass through the loop.
(c) Making two passes through the loop.
(d) Making “p” passes through the loop where p is the maximum number of passes.
(e) Making “n-1”, “n”, “n+1” passes through the loop.
3. For nested loops simply the testing approach of the simple loops is extended but, the number of the test cases increases geometrically as per the number of the nested loops and the level of nesting. Usually the following steps are followed:
(a) The inner most loop is the starting point for the testing.
(b) All other loops are set to minimum possible values.
(c) Simple loop tests are conducted for the inner most loop and the outer loops or the nesting loops are kept in their minimum values only till the testing of the inner most loop is complete.
(d) For the excluded values more tests are added.
(e) Now once the testing of the inner most loop is complete, this loop including all the other nested loops are set to typical values and the testing moves outwards. The other nesting loops are held with their minimum values.
(f) The testing in this manner continues until and unless all the loops have been tested.
4. For concatenated loops also the approach that has been defined for the testing of the simple loops can be used but only if the either loops are independent of each other i.e., if the loop counter for one of concatenated loop is 1 and it is used as the executing value for the other loop, then the two loops are said to be dependent on each other and hence the simple loop approach cannot be followed for them.
More about Loop Testing
- It has been observed so many times that most of the semantic bugs preside over the loops.
- It becomes difficult for the path testing also to commence since there are so many paths generated via a loop and an infected loop leads to infected paths which makes even further difficult to track the bug.
- Some of testers believe that it is just enough to test the loop only two times but this is not a good practice.
- A loop should be tested at the following three instances:
a) At the entry of the loop
b) During the execution of the loop and
c) At the exit of the loop
- Loop testing is aimed at testing a resource multiple numbers of times by executing it under a loop and this whole process is controlled by a diagnostic controller.
- However, one rule has been defined for the loop testing which is that the user can interact only at the entry and exit of the loop and nowhere in between.
Thursday, March 22, 2012
Loop testing is a white box testing technique - Explain?
Posted by
Sunflower
at
3/22/2012 11:26:00 AM
0
comments
Labels: Approaches, Concatenated Loops, Constructs, Loop testing, Loops, Nested loops, Passes, Simple Loops, Software testing, Structures, Techniques, Test cases, Tests, Unstructured loops, White box testing
![]() | Subscribe by Email |
|
Thursday, September 8, 2011
How is program controlled in C?
Every program follows a control path. C program control constructs are conditionals and loops. Almost every program needs to go through some sort of decision making. Decision making processes are simulated in C using conditionals. We can state a conditional as a statement that instructs the compiler to execute a function or statement if a certain condition is proved true. Decision making is done on the basis of some logic. Logic is treated as arithmetic by C compiler. The value 0 stands for true and rest any other value stands for a false value. The most common conditionals are if-else statements, switch case statements and loops.
If-else statements are used for conditional branching. It starts with if followed by an expression in its parentheses. The enclosed expression is evaluated and if the condition proves out to be true the succeeding statement is executed. If the condition is false the succeeding statement is skipped. Break and continue statements are used in if else and switch case constructs. Break will cause the execution to jump out of the loop and execute the following immediate statements whereas continue statement causes the loop to execute again and again until the condition is proved false.
Switch case begins with keyword switch followed by a variable to be switched enclosed in a parentheses. The word case is used to begin each case followed by a variable for that case, then a colon and then by the statements to be executed. Statements will be executed until a break is found. Any of the above constructs can be nested. Now coming to the go to statement, with this goto statement you can jump in between anywhere in a program except you are not allowed to jump in a loop. Goto statements are mostly risky but if there’s a place in the program where a goto statement fits , feel free to use it. However you should not be used.
Let’s define the loops now. C has 3 types of loops namely the while loop, for loop and the do while loop. The “while loop” continues to execute till the condition proves to be false. It’s an entry controlled loop which means that the loop will execute only when the condition is met. In this loop the keyword while is followed by some expression in parentheses, followed by a compound statement enclosed in braces. After reaching at the end of the loop, the control goes back to the top and the condition is revaluated.
Do while loop is an exit controlled loop. The test condition is evaluated at the end only. So even if the condition is false the loop is executed once compared to the while loop which doesn’t allows execution even once if the condition is false. You can call the do while loop as a pos check loop. This is the main difference between the while loop and the do while loop. These loops can also be nested. Nesting is unlimited. The “for loop” is the easiest loop. All its loop controlled elements are gathered at one place while in other loops they are scattered everywhere in the program. In a for loop firstly the initialization expression is executed. Then, the test expression is evaluated. If it’s true, the body of the loop is executed. After the execution the update expression is implemented, the test expression is again evaluated. If it’s true the whole sequence is repeated. You should use a for loop hen you have to repeat a block of statements specific number of times. These are the tools that programs need to perform repetitive tasks and make decisions.
Posted by
Sunflower
at
9/08/2011 06:42:00 PM
0
comments
Labels: Branching, C, C Language, Compiler, Conditions, Constructs, Control, Logical, Loops, Paths, program, Program control, Statements
![]() | Subscribe by Email |
|