Centre for Distance and Online
Education (CDOE)
SOFTWARE TESTING
(OPGDST402)
MODULE 4 Part 2
Centre for Distance and Online
Education (CDOE)
Syllabus
Centre for Distance and Online
Education (CDOE)
Data Flow Testing
• Data Flow Testing is a white-box testing technique that focuses
on the lifecycle of data variables within a program — how data is
defined, used, and killed (i.e., goes out of scope or is redefined).
• The goal is to uncover potential issues in variable usage, such
as using a variable before it's initialized, or defining a variable that is
never used.
• It builds upon the Control Flow Graph (CFG) by analyzing data
usage across different paths in the program.
Centre for Distance and Online
Education (CDOE)
Variable Use: p-use and c-use
• Use in the predicate of a branch statement is a predicate use or “p-
use”
• Any other use is a computation-use or “c-use”
• For example, in the program fragment:
Centre for Distance and Online
Education (CDOE)
DU Pair
A definition-use pair (“du-pair”) with respect to a variable v is a pair
(d,u) such that
• d is a node defining v
• u is a node or edge using v
Centre for Distance and Online
Education (CDOE)
DU Pair - Example 1
Centre for Distance and Online
Education (CDOE)
Identifying DU-Pairs (Variable A)
Centre for Distance and Online
Education (CDOE)
DU Path
A path <n1,n2,...,nj,nk> is a du-path with respect to a
variable v, if v is defined at node n1 and either:
• there is a c-use of v at node nk and <n1,n2,...,nj,nk> is
a def-clear simple path, or
• there is a p-use of v at edge <nj,nk> and <n1,n2,...nj>
is a def-clear loop-free path.
Centre for Distance and Online
Education (CDOE)
Example
1. int x = 10; // def(x) DU Path for variable x:
2. if (x > 5) { // p-use(x)
(1->2) Valid
3. y = x + 1; // c-use(x), def(y) (1->3) Valid
4. } (1->6) Invalid (because x is
redefined at line 5)
5. x = 20; // re-def(x)
6. z = x + y; // c-use(x, y)
Centre for Distance and Online
Education (CDOE)
Uses of DU Path
• A DU Path connects a definition of a variable to its use with no
redefinition in between.
• It’s essential for detecting:
– Uninitialized variable usage
– Dead code (definitions that are never used)
– Data anomalies
Centre for Distance and Online
Education (CDOE)
DD Path
A DD Path stands for Decision-to-Decision Path, and it is a concept
used in path testing in software testing to simplify the control flow
graph (CFG) of a program. It represents a sequence of statements or
nodes in the program that do not contain any decision point (like if,
while, for, etc.) except at the beginning and end.
Centre for Distance and Online
Education (CDOE)
DD Path
A DD Path is a maximal sequence of program statements such that:
•The first node is a decision point, or the entry point of the program.
•The last node is a decision point, a merge point, or the exit.
•All intermediate nodes are non-decision statements (like assignments,
print statements).
DD paths help reduce the complexity of the control flow graph and
make test path analysis more manageable.
Centre for Distance and Online
Education (CDOE)
Centre for Distance and Online
Education (CDOE)
Centre for Distance and Online
Education (CDOE)
Centre for Distance and Online
Education (CDOE)
Summary
• Data Flow Testing
• DU Pair
• DU Path
• DD Path
Centre for Distance and Online
Education (CDOE)
Happy Studying !