Professional Documents
Culture Documents
10-White Box Testing
10-White Box Testing
Sumber : http://www.if.itb.ac.id/~bayu
Introduction White Box testing
• White Box Testing or Glass Box Testing
– Test case design method that uses the control structure of the procedural
design to derive test cases
• SW Engineer can derive test cases that
– guarantee that all independent paths within a module have been exercised
at least once
– exercise all logical decisions on their true and false bounds
– execute all loops at their boundaries and within their operational bounds
– exercise internal data structures to assure their validity
• Why not just validate the requirement ?
– Logic errors and incorrect assumptions are inversely proportional to the
probability that a program path will be executed
– We often believe that a logical path is not likely to be executed when, in
fact, it may be executed on a regular basis
– Typographical errors are random
W h ile
Sequence
Case
R e p e a t - U n til
11. endif
9 5
12. endif 8
13. enddo
10 6
11
12
1
2 ,3
2
7
3
R2
7
4 8 R1 9 ,1 0 4 ,5 ,6
9 5
8
11
10 6
11
12
R3
12
R4
06/03/2021 Rini/S2 LIKMI
Compound Logic
P r e d ic a t e N o d e
IF a or b b
then procedure X
else procedure Y
y x x
endif
V(G) = E - N + 2
V(G) = 9 - 8 + 2
=3
path 1: 1-13
1
path 2: 1-2-3-7-8-11-12-1-13
2 ,3 path 3: 1-2-3-7-9-10-11-12-1-13
path 4: 1-2-3-4-5-6-12-1-13
7
8 9 ,1 0 4 ,5 ,6 Is the path
1-2-3-4-5-6-12-1-2-3-7-8-11-12-1-13
11
an independent path ?
13
12
N e s te d L o o p s
C o n c a te n a te d
S im p le L o o p s
Loops
U n s tru c tu re d
Loops
06/03/2021 Rini/S2 LIKMI 19
Loop Testing (2)
• To test:
· Simple Loops of size n:
· Skip loop entirely
· Only one pass through loop
· Two passes through loop
· m passes through loop where m<n.
· (n-1), n, and (n+1) passes through the loop.
· Nested Loops
· Start with inner loop. Set all other loops to minimum values.
· Conduct simple loop testing on inner loop.
· Work outwards
· Continue until all loops tested.
· Concatenated Loops
· If independent loops, use simple loop testing.
· If dependent, treat as nested loops.
· Unstructured loops
· Don't test - redesign.