Beruflich Dokumente
Kultur Dokumente
Structural Testing
in the program 2
8
has been F
i <= 10 return sum;
executed at T 3
least once, and F exit
i/2 == 0
every decision in 4
T
the program has
sum = sum + i;
taken all
possible 5
outcomes at i++; 6
least once.
7
1235672
3456728
Decision Coverage
d = (A B) C
path coverage
decision/condition coverage
statement coverage
Testing Simple Loops
T F
1 2 3 4 5 6 7
F T
T
8
F
F T
9 10
1 2 3 4 5 6 7 2 4
1 2 8 3 4 9 10 6 7 2 4 8 10
1 2 8 9 10 5 6 7 2 8 10
An Example
T F
1 2 3 4 5 6 7
F T
T
8
F
F T
9 10
1 2 3 4 5 6 7 2 4
1 2 3 4 9 10 5 6 7 2 4 10
1 2 3 4 9 10 6 7 2 4 10
1 2 8 3 4 9 10 6 7 2 4 8 10
1 2 8 9 10 6 7 2 8 10
An Example: Usage Information
T F
1 2 3 4 5 6 7
F T
T: 0.8 T
8
F: 0.2 F
F T
9 10
1 2 3 4 9 10 6 7 2 4 10
1 2 3 4 9 10 5 6 7 2 4 10
1 2 3 4 5 6 7 2 4
1 2 8 3 4 9 10 6 7 2 4 8 10
1 2 8 9 10 6 7 2 8 10
Path Predicate Expression
sum = sum + i;
1235
5
6728
6
i++;
unachievable
7
Test Oracle
6
i++;
7
An Example
1
entry sum = 0; 1235
8 6723
2
F 4567
i <= 10 return sum; 28
T 3
F exit path sensitization:
i/2 == 0
i=9
T 4
6
i++;
7