Unit 03
Unit 03
Unit 03
INPUT
OUTPUT
Observations
– Nodes 4-8 are a sequence, there
is no branching
– Nodes 9-12 are an IF-THEN-
ELSE construct
– Nodes 13-22 are nested IF-
THEN-ELSE constructs
– Nodes 4 and 23 are the program
source and sink nodes
• Single entry, single exit
– There are no loops, so this is a
directed acyclic graph
Decision – To – Decision Paths
(DD-Paths)
5-8 A 5
9 B 3
10 C 4
11 D 4
12 E 3
13 F 3
14 H 3
15 I 4
16 J 3
17 K 4
18 L 4
19 M 3
20 N 3
21 G 4
22 O 3
23 LAST 2
Program DD-Path Case of
Graph Nodes Name Definition
4 First 1
5-8 A 5
9 B 3 SOURCE
10 C 4
11 D 4
12 E 3
13 F 3
14 H 3
15 I 4
16 J 3
17 K 4
18 L 4
19 M 3
20 N 3
21 G 4
22 O 3
23 LAST 2 SINK
Structural Test Coverage Metrics
1.Statement and predicate testing:
P1=<13,14>
P1=<13,14,15,16>
P1=<19,20,14>
P1=<19,20,14,15,16>
Du-path Test Coverage Metrics Definitions
Slice Based Testing
The second type of data flow testing
A program slice is a set of program statements that
contribute to, or affect a value for a variable at some
point in the program.
The idea of slicing is to divide a program into
components that have some useful meaning
S(V,n)
Slice Based Testing
The USE relationship pertains to five forms of usage:
– P-use: used in a predicate (decision)
– C-use: used in a computation
– O-use: used for output
– L-use: used for location (e.g. pointers)
– I-use: used for iteration (internal counters, loop
indices)
Definition nodes:
– I-def: defined by input
– A-def: defined by assignment
du-Paths for Locks:
DEF(locks,13),DEF(locks,19),
USE(locks,14),and USE(locks,16).
Slice Based Testing
S1: S(locks,13) = {13} (defining node I-def)
• S2: S(locks,14) = {13,14,19,20}
• S3: S(locks,16) = {13,14,16,19,20}
• S4: S(locks,19) = {19} (defining node I-def)