Monday, September 23, 2024
Google search engine
HomeGuest BlogsData Flow Testing

Data Flow Testing

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
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments