Flow Graph in Software Testing

Introduction

Flow Graph is defined as a function in a program that can be represented as a control flow graph and the nodes in the flow graph are defined as program statements while the directed edges are the flow of control. A Flow Graph consists of nodes and edges. The two nodes in the Flow Graph can be either unconnected or connected by an edge in either direction or connected by an edge in all directions.

While tracing a path from a source to a sink a back edge is an edge that leads back to a node that has already been visited. The Flow Graph contains one source node and one sink.
A source node is the node that has no incoming edges while a sink node is the node with no outgoing edges. A program's function may contain more than one sink node, but this graph can be converted into a graph with only one sink. There are some languages that allow more than one source. This construct is very rare and not used in Structured Programming.
 

  1. Used as a main tool for test case identification.
  2. Represents the relationship between program segments, that is the sequence of statements having the property that if the first member of the sequence is executed then all other statements in that sequence will also be executed.
  3. Nodes represent one program segment.
  4. The area bounded by edges and nodes are called regions.

Flow Graph Symbols

Standard notations used in constructing a flow graph are as in the following.

To indicate a Sequence:

FlowGraph-Sequence.JPG

To indicate "IF-THEN-ELSE":

FlowGraph2.JPG

To indicate a "WHILE" Loop:

FlowGraph-While.JPG

To indicate a "Repeat-Until" Loop:

FlowGraph-Until.JPG

To indicate a "CASE" Statement:

FlowGraph-Case.JPG

On a Flow Graph:

  1. Arrows called edges indicates flow of control.
  2. Circles called nodes indicates one or more actions.
  3. Areas bounded by edges and nodes are called regions.
  4. A predicate node is a node containing a condition.


Similar Articles