White Box Testing
White Box Testing
by :
Oerip S. Santoso
Overview
Reviews
Expert opinions
Software testing
Software maintenance
Assurance of the quality of
the subcontractors work and
the customersupplied parts.
Software tests are formal SQA components
that are targeted toward review of the
actual running of the software.
Software Testing Strategy
While
Sequence
Case
Repeat - Until
11
12
1
2,3
2
7
4 8 9,10 4,5,6
7
9 5
8
11
10 6
11 12
12
Predicate Node
IF a or b
b
then procedure X
else procedure Y
y x x
endif
Predicate Node
IF a and b
b
then procedure X
else procedure Y
endif
y x yx
V(G) = E - N + 2
1
2
3 V(G) = 9 - 8 + 2
=3
4 5
The number of regions of the flow graph
6
correspond to the cyclomatic complexity.
7 V(G) = P + 1, where P is the number of
predicate nodes
8
10/10/2017 Bayu Hendradjaya - http://www.if.itb.ac.id/~bayu 10
Independent Path
An independent path is any path through the program that introduces
at least one new set of processing statements or a new condition
An independent path must move along at least one edge that has not
been traversed before the path is defined
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
7
path 4: 1-2-3-4-5-6-12-1-13
Nested Loops
Concatenated
Simple Loops
Loops
Unstructured
Loops
10/10/2017 Bayu Hendradjaya - http://www.if.itb.ac.id/~bayu 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.
10/10/2017 Bayu Hendradjaya - http://www.if.itb.ac.id/~bayu 20
Latihan
Buka file Exercise
Untuk setiap soal :
1. Buat flow graf
2. Tentukan region
3. Hitung V(G) = E-N + 2 dan predicate node
4. Tentukan jalur independen
5. Buat matriks graf
6. Buat test case sesuai jalur independen