Data flow testing is a family of test strategies based on selecting paths through the program's control flow in order to explore sequences of events related to the status of variables or data objects. Dataflow Testing focuses on the points at which variables receive values and the points at which these values are used.
Data Flow testing helps us to pinpoint following issues:
- A variable that is declared but never used within the program.
- A variable that is used but never declared.
- A variable that is defined multiple times before it is used.
- Deallocating a variable before it is used.
Data flow testing tells us that a programmer can perform can perform a number of tests on data values, which are collectively known as data flow testing. Data flow testing can be performed at two conceptual levels: static data flow testing and dynamic data flow testing.
- Static data flow testing is performed by analysing the source code, and it does not involve actual execution of source code.
- Static data flow testing is performed to reveal potential defects in programs which are commonly known as data flow anomaly.
- Dynamic data flow testing involves identifying program paths from source code based on a class of data flow testing criteria.
Data flow testing is generally performed in the following steps :
- Draw a data flow graph from a program.
- Select one or more data flow testing criteria.
- Identify paths in data flow graph satisfying the selection criteria.
- Derive path predicate expressions from the selected paths and solve those expressions to derive test input.
Feasible paths and test selection criteria in data flow testing :
Feasible path :
- Given a data flow graph, a path is sequence of nodes and edges.
- A complete path is a sequence of nodes and edges starting from the initial node of the graph to one of its exit nodes.
- A complete path is executable if there exists an assignment of values to input variables and global variables such that all the path predicates evaluate to true, thereby making the path executable.
- Executable paths are also known as feasible paths.
- If no such assignment of values to input variables and global variables exists, then the path is called as infeasible or inexecutable.
Test Selection Criteria in data flow testing :
Following are the seven types of data flow testing criteria. These criteria are based on two fundamental concepts, namely, definitions and uses- both c-uses and p-uses of variables.
1.All-defs : For each variable x and for each node i such that x has a global definition in node i , select a complete path which includes a def-clear path from node i to
Node j having a global c-use of x or
Edge (j,k) having a p-use of x.
2.All c-uses : For each variable x and for each node i such that x has a global definition in node i , select complete paths which includes def-clear paths from node i to all nodes j such that there is a global c-use of x in j.
3.All p-uses : For each variable x and for each node i such that x has a global definition in node i , select complete paths which includes def-clear paths from node i to all edges (j,k) such that there is a p-use of x on edge (j,k).
4.All p-uses/Some c-uses : This criterion is identical to all p-uses criterion except when a variable x has no p-use. If x has no p-use, then this criterion reduces to the some c-uses criterion explained below
- Some c-uses : For each variable x and for each node i such that x has a global definition in node i, select complete paths which include def-clear paths from node i to some nodes j such that there is a global c-use of x in node j.
5.All c-uses/Some p-uses : This criterion is identical to all c-uses criterion except when a variable x has no global c-use. If x has no global c-use, then this criterion reduces to the some p-uses criterion explained below
- Some p-uses : For each variable x and for each node i such that x has a global definition in node i, select complete paths which include def-clear paths from node i to some edges (j,k) such that there is a p-use of x on edge (j,k).
6.All uses: This criterion is the conjunction of the all p-uses criterion and the all c-uses criterion as explained above.
7.All du-paths: For each variable x and for each node i such that x has a global definition in node i, select complete paths which include all du-paths from node i
To all nodes j such that there is a global c-use of x in j and
To all edges (j,k) such that there is a p-use of x on (j,k).
Thank you for sharing information on Data flow testing strategy.It is really heplful for us. Software Testing Training in Mumbai
ReplyDelete