Professional Documents
Culture Documents
Flow Graph and Path Testing
Flow Graph and Path Testing
Yekollu Ravi
Basic concepts of path testing
Path testing:
Path Testing is a structural testing method
based on the source code or algorithm and NOT
based on the specifications.
Test cases based on Basis path testing grantee to
execute every statement in program at least
once.
THE BUG ASSUMPTION:
The bug assumption for the path testing
strategies is that something has gone wrong
with the software that makes it take a
different path than intended.
As an example "GOTO X" where "GOTO Y" had
been intended.
Flow graph
A flow graph depicts the logical control flow
using the following notations
Flow graph
Each circle, called flow graph node, represents
one or more procedural statements.
The arrows called as links or edged represent
flow of control.
Areas bounded by edges are called regions. while
counting regions the area outside the graph is
also taken as a region.
Each node containing a condition is called a
predicate node and has 2 or more edges out of it.
Flow graph
Flow Graph Elements:
A flow graph contains four different types of
elements.
Process Block
Decisions
Junctions
Case Statements
Flow graph
Process block:
X
Decision:
Yes Do Function1()
Input
If A = B
No Do Function2()
Junctions:
interrupt
1 2
Case statement:
Case n
Control Flow Graph Vs Flow Charts
Inside details of a process block are not Every part of the process block are
shown drawn
INPUT X, Y
Z := X + Y
V := X - Y
IF Z >= 0 GOTO SAM
JOE: Z := Z + V
SAM: Z := Z - V
FOR N = 0 TO V NO
Z := Z - 1 INPUT X, Y Z := X + Y V := X - Y Z >= 0 ? JOE
NEXT N
END
LOOP SAM Z := Z + V
Z := Z - 1 N := 0 Z := Z - V
NO
N=V? N := N+1
YES
END One to One Flow Chart
Notational evolution - Creation of Control Flow Graph from a program
INPUT X, Y
Z := X + Y
V := X - Y
IF Z >= 0 GOTO SAM
JOE: Z := Z + V
SAM: Z := Z - V
FOR N = 0 TO V NO
Z := Z - 1 P1 Z >= 0 ? JOE
NEXT N
END
LOOP SAM P2
P4 P3
NO
N=V? P5
YES
END
Simplified Flow Graph
Flow graph-program correspondence
Flow graph is a pictorial representation of a program and not the
program itself
The translation from a flow graph element to a statement and
vice versa is not always unique.
NO NO
NO
Fig: Alternative Flow graphs for same logic (Statement "IF (A=0) AND (B=1) THEN . . .").
Flow graph and flow chart generation
1.Hand-drawn by programmer.
2.Automatically produced by a flowcharting program
based on a mechanical analysis of the source code.
3.Semi automatically produced by a flow charting program
based in part on structural analysis of the source code
Basic concepts- nodes, links and paths
path testing
statement testing
branch testing
Picking appropriate tests paths
Observe the control flow graph that drawn to represent the program structure.
List all these paths that are being identified so that C1+C2 criteria has been
fulfilled.
Form the table from graphical representation with labelled links.
Types of loops:
single loop
nested loops
concatenated loops
Predicates, Path Predicates and Achievable paths
Predicate:
Its a logical function evaluated at decision point.
Predicates, Path Predicates and Achievable paths
Path predicate:
A predicate associated with a path is called a predicate
path.
Predicate interpretation:
The act of symbolic substitution of operations along
the path in order to express the predicate solely in terms of
the input vector is called interpretation.
Predicates, Path Predicates and Achievable paths