written 8.4 years ago by |
White Box Test
The white box testing is a testing method which is based on close examination of procedural details. Hence it is also called as glass box testing
In white box testing the test cases are derived for
- Examining all the independent paths within a module.
- Exercising all the logical paths with their true and false sides.
- Executing all the loops within their boundaries and within operational bounds.
- Exercising internal data structures to ensure their validity.
There are following reason behind performing white box testing
Programmers may have some incorrect assumptions while designing or implementing some function. Due to this there are chances of having logical errors in the program. To detect and correct such logical errors procedural details need to be examined.
Certain assumption on flow of control and data may lead programmer to make design errors. To uncover the errors on logical path, white box is must.
There may be certain typographical errors that remain undetected even after syntax and type checking mechanism. Such errors can be uncovered during white box testing.
1. Structural testing
- The structural testing is sometimes called as white box testing.
- In structural testing derivation of test cases is according to program structure. Hence knowledge of the program is used to identify additional test cases.
- Objective of structural testing is to exercise all program statements.
2. Condition testing
- To test logical conditions in the program module the condition testing is used .This condition can be a Boolean condition or a relational expression.
The condition is incorrect in following situations.
- Boolean operator is incorrect, missing or extra.
- Boolean variable is incorrect.
- Boolean parenthesis may be missing, incorrect or extra.
- Error in relational operator.
- Error in arithmetic expression.
The condition testing focuses on each testing condition in the program.
- The branch testing is a condition testing strategy in which for a compound condition each and every true or false branches are tests.
- The domain testing is a testing strategy in which relational expression can be tested using three or four tests.
3. Loop testing
- Loop testing is a white box testing technique which is used to test the loop constructs. Basically there are four types of loops.
- Following fig shows the classes of loops.
i. Simple Loop:
The tests can be performed for n number of classes. Where - n=0 that means skip the loop completely. - n=1 that means one passes through the loop is tested. - n=2 that means two passes through the loop is tested. - n=m that means testing is done when there are m passes where m<n. -="" performs="" the="" testing="" when="" number="" of="" passes="" are="" n-1,="" n,="" n+1.<="" p="">
ii. Nested loops:
The nested loop can be tested as follows:
- Testing begins from the innermost loop first. At the same time set all the other loops to minimum values.
- The simple loop test for innermost loop is done.
- Conduct the loop testing for the next loop by keeping the outer loops at minimum values and other nested loops at some specified values.
- This testing process is continued until all the loops have been tested.
iii. Concatenated loops:
The concatenated loops can be tested in the same manner as simple loop tests, if each of loop is independent of the other. However if two loops are concatenated and the loop counter for loop 1 is used as the initial value for loop 2, then the loops are not independent. When the loops are not independent, ate approach applied to nested loop is recommended.
iv. Unstructured loops:
The testing cannot be effectively conducted for unstructured loops. Hence these types of loops needs to be redesigned.
4. Path testing
Path testing is a structural testing strategy. This method is intended to exercise every independent execution path of program at least once.
Following are the steps that are carried out while performing path testing
Step 1: Design the flow graph for the program or a component.
Step 2: calculate the cyclomatic complexity.
Step 3: select a basis set of path.
Step 4: generate test cases for these paths.