Software testing techniques Testing criteria based on data flow Presentation on the seminar Kaunas University of Technology
What is data-flow testing? Data-flow testing is a white box testing technique that can be used to detect improper use of data values due to coding errors. Testing criteria based on data flow
Testing criteria based on data flow The General Idea A program unit accepts inputs, performs computations, assigns new values to variables, and returns results. One can visualize of “flow” of data values from one statement to another. A data value produced in one statement is expected to be used later. Testing criteria based on data flow
Data flow testing can be performed at two conceptual levels Static data flow testing Dynamic data flow testing Testing criteria based on data flow
Static data flow testing Identify potential defects, commonly known as data flow anomaly. Analyze source code. Do not execute code. Testing criteria based on data flow
Dynamic data flow testing Involves actual program execution. Bears similarity with control flow testing. Identify paths to execute them. Paths are identified based on data flow testing criteria. Testing criteria based on data flow
Testing criteria based on data flow Data Flow Anomaly Anomaly: It is an abnormal way of doing something. Example: The second definition of x overrides the first. x = f1(y); x = f2(z); Testing criteria based on data flow
Abnormal situations with using variable. Defined and then defined again Undefined but referenced Defined but not referenced Defined and destroyed Destroyed before definition Destroyed and then referenced Destroyed twice Testing criteria based on data flow
Testing criteria based on data flow Data Flow Graph A data flow graph is a directed graph constructed as follows. A sequence of definitions and uses is associated with each node of the graph. The entry nodes usually contains definitions of variables used in the program. The exit node has an undefinition of each local variable. Testing criteria based on data flow
Testing criteria based on data flow Data Flow Graph Public double calculateBill(int Usage) { double Bill = 0; if(Usage > 0) Bill = 40; if(Usage > 100) Bill = Bill + Usage – 10; return Bill } Testing criteria based on data flow
Seven data flow testing criteria All-defs All-c-uses All-p-uses All-p-uses/some-c-uses All-c-uses/some-p-uses All-uses All-du-paths Testing criteria based on data flow
Testing criteria based on data flow All-definition Every definition of every variable be covered by at least one use of that variable, be that use a computational use or a predicate use. In this strategy, there is path from every definition to at least one use of that definition. Testing criteria based on data flow
Testing criteria based on data flow All-c-uses In this testing strategy, for every variable, there is a path from every definition to every c-use of that definition. If there is a definition with no c-use following it, then it is dropped from contention. Testing criteria based on data flow
Testing criteria based on data flow All-p-uses In this testing strategy, for every variable, there is path from every definition to every p-use of that definition. If there is a definition with no p-use following it, then it is dropped from contention. Testing criteria based on data flow
All-p-uses/some-c-uses For every variable and every definition of that variable, include at least one path from the definition to every predicate use; if there are definitions of the variable that are not covered then add computational use test cases as required to cover every definition. In this testing strategy, for every variable, there is a path from every definition to every p-use of that definition. If there is a definition with no p-use following it, then a c-use of the definition is considered. Testing criteria based on data flow
All-c-uses/some-p-uses For every variable and every definition of that variable, include at least one path from the definition to every computational use; if there are definitions of the variable that are not covered then add predicate use test cases as required to cover every definition. In this testing strategy, for every variable, there is a path from every definition to every c-use of that definition. If there is a definition with no c-use following it, then a p-use of the definition is considered. Testing criteria based on data flow
Testing criteria based on data flow All-uses At least one path from every definition of every variable to every use of that can be reached by that definition. For every use of the variable, there is a path from the definition of that variable to the use. Testing criteria based on data flow
Testing criteria based on data flow All-du-paths Every du path from every definition of every variable to every use of that definition. It is the strongest data-flow testing strategy since it is a superset of all other data flow testing strategies. Moreover, this strategy requires greatest number of paths for testing. Testing criteria based on data flow
Testing criteria based on data flow Questions Is Data-flow testing a white box or black box testing technique? What are two data flow conceptual levels? Whitch of data flow testing criteria is the strongest testing strategy? Testing criteria based on data flow
Testing criteria based on data flow Thank you Testing criteria based on data flow