
Software Testing - Data Flow Testing
Software testing consists of white box, black box, and gray box testing methodologies. The white box testing mainly deals with the verification of the data structures, algorithms, logic, flow, and code. It also requires the knowledge of the internal structure of the software. Data flow testing is one of the concepts under the white box testing. It is a technique whose objective is to evaluate how the variables are defined and utilized within the program.
What is Software Data Flow Testing?
The software data flow testing is an integral part of the white box testing. It takes the help of the control flow graph to determine the paths where the variables are defined, and later used. This is done with the only intent to detect issues namely inaccurate definitions, and to identify variables which are not in service. By following the flow of data, it confirms that the variables are handled correctly, and well utilized in the code.
The software data flow testing defines the method that is taken up to obtain test paths of the code as per the locations of definitions, and variable usage in the program. It has no relation with the data flow diagrams. It is mainly focused with the statements where the variables get the values, and where those values are utilized or referenced.
The software data flow testing takes the help of the control flow graph to determine the circumstances that can affect the program flow. Some of the issues that are observed in the data flow when variables and values are used together are listed below −
- Variables have been defined but not utilized or referenced.
- Variables have been used but are undefined.
- Variables have been defined multiple times prior to being used.
The software data flow testing generates the test cases that touch the control flow paths around the definition of variables, and their uses in the modules.
Types of Software Data Flow Testing
The different types of the software data flow testing are listed below −
1. Testing for All-Du-Paths − It refers to the All Definitions Use Paths. It verifies all possible paths from the variable definition to the usage.
2. All-Du-Paths Predicate Node Testing − It verifies the predicate nodes, or decision points which are the part of the control flow graph.
3. All-Uses Testing − It verifies every place where a variable is utilized.
4. All-Defy Testing − It verifies every place where a variable is specified.
5. Testing for All-P-Uses − It refers to the All Possible Uses. It verifies all probable usages of a variable.
6. All-C-Uses Test − It refers to the All Computation Uses. It verifies all possible paths where a variable has been used for calculations.
7. Testing for All-I-Uses − It refers to the All Input Uses. It verifies all possible paths where a variable is obtained from external inputs.
8. Testing for All-O-Uses − It refers to the All Output Uses. It verifies all possible paths where a variable is used to generate outputs.
9. Testing for Definition-Use Pairs − It focuses on specific pairs of definitions, and uses for variables.
10. Testing for Use-Definition Paths − It evaluates the path that leads to the point where a variable is used and then defined.
Example
Let us take an example of the below block of code from where we would create the control flow graph and then evaluate data flow testing.
IF M = 550 THEN IF N > O THEN M = N ELSE M = O END IF END IF PRINT M
The control flow graph of the above lines of code has been described below −

The use and definition of variables at the various nodes in the control flow graph for the above example are illustrated in the below table −
Variables | Nodes Defined | Used at Node Number |
---|---|---|
M | 3 ,4 | 1, 7 |
N | NA | 2, 3 |
O | NA | 4 |
From the above table, it is concluded that the variables N, and O have never been defined but later used in the program.
Advantages of Software Data Flow Testing
The advantages of the software data flow testing are listed below −
- The software data flow testing identifies variables which are used but not defined.
- The software data flow testing identifies variables which are defined but not used.
- The software data flow testing identifies variables which are defined more than one time prior being used.
- The software data flow testing helps to deallocate a variable prior being used.
Disadvantages of Software Data Flow Testing
The disadvantages of the software data flow testing are listed below −
- The software data flow testing is an expensive, and time taking activity.
- The testers performing the software data flow testing should be experienced, and should have technical, and programming skills
Conclusion
This concludes our comprehensive take on the tutorial on Software Data Flow Testing. Weve started with describing what is software data flow testing, what are the different types of the software data flow testing, an example to illustrate data flow testing, what are the advantages of the software data flow testing, and what are the disadvantages of the software data flow testing. This equips you with in-depth knowledge of Software Data Flow Testing. It is wise to keep practicing what youve learned and exploring others relevant to Software Testing to deepen your understanding and expand your horizons.