Open In App
Related Articles

Data Flow Testing

Improve Article
Improve
Save Article
Save
Like Article
Like

Data Flow Testing is a type of structural testing. It is a method that is used to find the test paths of a program according to the locations of definitions and uses of variables in the program. It has nothing to do with data flow diagrams.
It is concerned with:

  • Statements where variables receive values,
  • Statements where these values are used or referenced.

To illustrate the approach of data flow testing, assume that each statement in the program assigned a unique statement number. For a statement number S-

DEF(S) = {X | statement S contains the definition of X}
USE(S) = {X | statement S contains the use of X} 

If a statement is a loop or if condition then its DEF set is empty and USE set is based on the condition of statement s.

Data Flow Testing uses the control flow graph to find the situations that can interrupt the flow of the program.
Reference or define anomalies in the flow of the data are detected at the time of associations between values and variables. These anomalies are:

  • A variable is defined but not used or referenced,
  • A variable is used but never defined,
  • A variable is defined twice before it is used

Advantages of Data Flow Testing:
Data Flow Testing is used to find the following issues-

  • To find a variable that is used but never defined,
  • To find a variable that is defined but never used,
  • To find a variable that is defined multiple times before it is use,
  • Deallocating a variable before it is used.

Disadvantages of Data Flow Testing

  • Time consuming and costly process
  • Requires knowledge of programming languages

Example:

1. read x, y;
2. if(x>y)
3. a = x+1
else
4. a = y-1
5. print a; 

Control flow graph of above example:

Define/use of variables of above example:

Variable Defined at node Used at node
x 1 2, 3
y 1 2, 4
a 3, 4 5

Master Software Testing and Automation in an efficient and time-bound manner by mentors with real-time industry experience. Join our Software Automation Course and embark on an exciting journey, mastering the skill set with ease!
What We Offer:
  • Comprehensive Software Automation program
  • Expert Guidance for Efficient Learning
  • Hands-on Experience with Real-world Projects
  • Proven Track Record with 10,000+ Successful Geeks

Last Updated : 24 Oct, 2019
Like Article
Save Article
Previous
Next
Similar Reads