dataflow testing - eecs.yorku.ca · dataflow testing testing all-nodes ... alpha 25 51, 123 beta...
TRANSCRIPT
![Page 1: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/1.jpg)
Dataflow Testing
Chapter 10
![Page 2: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/2.jpg)
DFT–2
Dataflow Testing
Testing All-Nodes and All-Edges in a control flow graphmay miss significant test cases
Testing All-Paths in a control flow graph is often too time-consuming
Can we select a subset of these paths that will reveal themost faults?
Dataflow Testing focuses on the points at which variablesreceive values and the points at which these values areused
![Page 3: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/3.jpg)
DFT–3
Concordance
What is a concordance?
![Page 4: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/4.jpg)
DFT–4
Concordance – 2
What is a concordance?
An alphabetical list of the words (esp. the importantones) present in a text, usually with citations of thepassages concerned
Used to help find particular passages
Also used to analyze books to establish authorship A concordance to the Bible
What is the a concordance wrt to program text? What is the analogue?
![Page 5: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/5.jpg)
DFT–5
Concordance – 2
Data flow analysis is in part based concordance analysissuch as that shown below
Result is a variable cross-reference table
18 beta ← 2 25 alpha ← 3 × gamma + 1 51 gamma ← gamma + alpha - beta123 beta ← beta + 2 × alpha124 beta ← gamma + beta + 1
Defined Usedalpha 25 51, 123beta 18, 123, 124 51, 123, 124gamma 51 25, 51, 124
![Page 6: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/6.jpg)
DFT–6
Dataflow Analysis
Can reveal interesting bugs
A variable that is defined but never used
A variable that is used but never defined
A variable that is defined twice before it is used
Sending a modifier message to an object more thanonce between accesses
Deallocating a variable before it used
Container problem Deallocating container loses references to items in
the container, memory leak
![Page 7: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/7.jpg)
DFT–7
Dataflow Analysis – 2
Bugs can be found from a cross-reference table usingstatic analysis
Paths from the definition of a variable to its use are morelikely to contain bugs
![Page 8: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/8.jpg)
DFT–8
Definitions
A node n in the program graph is a defining node forvariable v – DEF(v, n) – if the value of v is defined at thestatement fragment in that node
Input, assignment, procedure calls
A node in the program graph is a usage node for variablev – USE(v, n) – if the value of v is used at the statementfragment in that node
Output, assignment, conditionals
![Page 9: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/9.jpg)
DFT–9
Definitions – 2
A usage node is a predicate use, P-use, if variable vappears in a predicate expression
Always in nodes with outdegree ≥ 2
A usage node is a computation use, C-use, if variable vappears in a computation
Always in nodes with outdegree ≤ 1
![Page 10: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/10.jpg)
DFT–10
Definitions – 3
A node in the program is a kill node for a variable v– KILL(v, n) – if the variable is deallocated at thestatement fragment in that node
![Page 11: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/11.jpg)
DFT–11
Example 2 – Billing program
calculateBill (usage : INTEGER) : INTEGERdouble bill = 0;
if usage > 0 then bill = 40 fiif usage > 100then if usage ≤ 200
then bill = bill + (usage – 100) *0.5else bill = bill + 50 + (usage – 200) * 0.1 if bill ≥ 100 then bill = bill * 0.9 fi
fifireturn billend Kill node for bill
![Page 12: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/12.jpg)
DFT–12
Definition-Use path
What is a du-path?
![Page 13: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/13.jpg)
DFT–13
Definition-Use path – 2
What is a du-path?
A definition-use path, du-path, with respect to a variablev is a path whose first node is a defining node for v, andits last node is a usage node for v
![Page 14: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/14.jpg)
DFT–14
Definition clear path
What is a dc-path?
![Page 15: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/15.jpg)
DFT–15
Definition clear path – 2
What is a dc-path?
A du-path with no other defining node for v is adefinition-clear path
![Page 16: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/16.jpg)
DFT–16
1 int max = 0;2 int j = s.nextInt();3 while (j > 0)4 if (j > max) {5 max = j;6 }7 j = s.nextInt();8 }9 System.out.println(max);
Example 1 – Max program
A definition of j
A C-use of j
P-uses of j & max
A definition of j
Definitionsof max
A C-use of max
![Page 17: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/17.jpg)
DFT–17
Max program – analysis
LegendA..F Segment named defining node for ju use node for j
int max = 0;int j = s.nextInt();
while (j > 0)
System.out.println(max);
max = j;
if (j > max)
j = s.nextInt();
A
B
C
D
E
F
d
d
u
u
u
dc-paths jA BA B CA B C DE BE B CE B C D
dc-paths maxA B FA B CD E B CD E B F
![Page 18: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/18.jpg)
DFT–18
Dataflow Coverage Metrics
Based on these definitions we can define a set ofcoverage metrics for a set of test cases
We have already seen
All-Nodes
All-Edges
All-Paths
Data flow has additional test metrics for a set T of paths ina program graph
All assume that all paths in T are feasible
![Page 19: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/19.jpg)
DFT–19
All-Defs Criterion
The set T satisfies the All-Def criterion For every variable v, T contains a dc-path from
every defining node for v to at least one usagenode for v
Not all use nodes need to be reached
!
"v #V (P),nd# prog_ graph(P) |DEF(v,nd)•$nu# prog_ graph(P) |USE(v,nu)•dc _ path(nd,nu)#T
![Page 20: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/20.jpg)
DFT–20
All-Uses Criterion
The set T satisfies the All-Uses criterion iff
For every variable v, T contains dc-paths that start atevery defining node for v, and terminate at every usagenode for v
Not DEF(v, n) × USE(v, n) – not possible to have a dc-path from every defining node to every usage node
!
("v #V (P),nu# prog_ graph(P) |USE(v,nu)•$nd# prog_ graph(P) |DEF(v,nd) • dc _ path(nd,nu)#T)%
all_ defs_criterion
![Page 21: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/21.jpg)
DFT–21
All-P-uses / Some-C-uses
The set T satisfies the All-P-uses/Some-C-uses criterion iff
For every variable v in the program P, T contains a dc-path from every defining node of v to every P-use nodefor v
If a definition of v has no P-uses, a dc-path leads toat least one C-use node for v
!
("v #V (P),nu# prog_ graph(P) |P _ use(v,nu)•$nd# prog_ graph(P) |DEF(v,nd) • dc _ path(nd,nu)#T)%
all_ defs_criterion
![Page 22: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/22.jpg)
DFT–22
All-C-uses / Some-P-uses
The test set T satisfies the All-C-uses/Some-P-usescriterion iff
For every variable v in the program P, T contains a dc-path from every defining node of v to every C-use of v
If a definition of v has no C-uses, a dc-path leads toat least one P-use
!
("v #V (P),nu# prog_ graph(P) |C _ use(v,nu)•$nd# prog_ graph(P) |DEF(v,nd) • dc _ path(nd,nu)#T)%
all_ defs_criterion
![Page 23: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/23.jpg)
DFT–23
Miles-per-gallon Program
miles_per_gallon ( miles, gallons, price : INTEGER )
if gallons = 0 then
// Watch for division by zero!! Print(“You have “ + gallons + “gallons of gas”)
else if miles/gallons > 25
then print( “Excellent car. Your mpg is “ + miles/gallon)
else print( “You must be going broke. Your mpg is “ + miles/gallon + “ cost “ + gallons * price)
fiend
![Page 24: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/24.jpg)
DFT–24
Miles-per-gallon Program – 2
We want du- and dc-paths
What do you do next?
![Page 25: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/25.jpg)
DFT–25
Mile-per-gallon Program – Segmented
gasguzzler (miles, gallons, price : INTEGER) Aif gallons = 0 then B // Watch for division by zero!! C Print(“You have “ + gallons + “gallons of gas”)else if miles/gallons > 25 D then print( “Excellent car. Your mpg is “ E + miles/gallon) else print( “You must be going broke. Your mpg is “ F + miles/gallon + “ cost “ + gallons * price)fi Gend
![Page 26: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/26.jpg)
DFT–26
Miles-per-gallon Program – 3
We want du- and dc-paths
What do you do next?
![Page 27: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/27.jpg)
DFT–27
MPG program graph
What do you do now?
![Page 28: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/28.jpg)
DFT–28
MPG program graph
Def miles,gallons
P-usegallons
P-use miles,gallons
C-use gallons
C-use miles, gallons, price
C-use miles, gallons
PossibleC-use miles, gallonsBut not commonpractice
![Page 29: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/29.jpg)
DFT–29
Miles-per-gallon Program – 4
We want du- and dc-paths
What do you do next?
![Page 30: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/30.jpg)
DFT–30
Example du-paths
For each variable in the miles_per_gallon program createthe test paths for the following dataflow path sets
All-Defs (AD)
All-C-uses (ACU)
All-P-uses (APU)
All-C-uses/Some-P-uses (ACU+P)
All-P-uses/Some-C-uses (APU+C)
All-uses
![Page 31: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/31.jpg)
DFT–31
MPG – DU-Paths for Miles
All-Defs
Each definition of each variable for at least one use ofthe definition
A B D
All-C-uses
At least one path of each variable to each c-use of thedefinition
A B D E A B D F A B D
![Page 32: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/32.jpg)
DFT–32
MPG – DU-Paths for Miles – 2
All-P-uses
At last one path of each variable to each p-use of thedefinition
A B D
All-C-uses/Some-P-uses
At least one path of each variable definition to each c-use of the variable. If any variable definitions are notcovered use p-use
A B D E A B D F A B D
![Page 33: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/33.jpg)
DFT–33
MPG – DU-Paths for Miles – 3
All-P-uses/Some-C-uses
At least one path of each variable definition to each p-use of the variable. If any variable definitions are notcovered by p-use, then use c-use
A B D
All-uses
At least one path of each variable definition to each p-use and each c-use of the definition
A B D A B D E A B D F
![Page 34: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/34.jpg)
DFT–34
MPG – DU-Paths for Gallons
All-Defs
Each definition of each variable for at least one use of thedefinition
A B
All-C-uses
At least one path of each variable to each c-use of thedefinition
A B C A B D E A B D F A B D
![Page 35: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/35.jpg)
DFT–35
MPG – DU-Paths for Gallons – 2
All-P-uses
At least one path of each variable definition to each p-use of the definition
A B A B D
All-C-uses/Some-P-uses
At least one path of each variable definition to each c-use of the variable. If any variable definitions are notcovered by c-use, then use p-use
A B C A B D E A B D F A B D
![Page 36: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/36.jpg)
DFT–36
MPG – DU-Paths for Gallons – 3
All-P-uses/Some-C-uses
At least one path of each variable definition to each p-use of the variable. If any variable definitions are notcovered use c-use
A B A B D
All-uses
At least one path of each variable definition to each p-use and each c-use of the definition
A B A B C A B D A B D E A B D F
![Page 37: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/37.jpg)
DFT–37
MPG – DU-Paths for Price
All-Defs
Each definition of each variable for at least one use ofthe definition
A B D F
All-C-uses
At least one path of each variable to each c-use of thedefinition
A B D F
![Page 38: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/38.jpg)
DFT–38
MPG – DU-Paths for Price – 2
All-P-uses
At least one path of each variable definition to each p-use of the definition
None
All-C-uses/Some-P-uses
At least one path of each variable definition to each c-use of the variable. If any variable definitions are notcovered use p-use
A B D F
![Page 39: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/39.jpg)
DFT–39
MPG – DU-Paths for Price – 2
All-P-uses/Some-C-uses
At least one path of each variable definition to each p-use of the variable. If any variable definitions are notcovered use c-use
A B D F
All-uses
At least one path of each variable definition to each p-use and each c-use of the definition
A B D F
![Page 40: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/40.jpg)
DFT–40
Rapps-Weyuker data flow hierarchy
All-Paths
All-DU-Paths
All-Uses
All-C-usesSome-P-uses
All-Defs All-P-uses
All-Edges
All-Nodes
All-P-usesSome-C-uses
![Page 41: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/41.jpg)
DFT–41
Potential Anomalies – static analysis
Anomalies Explanation~ d first define ???du define-use ???dk define-kill ???~ u first use ???ud use-define ???uk use-kill ???~ k first kill ???ku kill-use ???
Data flow node combinations for a variableAllowed? – Potential Bug? – Serious defect?
![Page 42: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/42.jpg)
DFT–42
Potential Anomalies – static analysis – 2
Data flow node combinations for a variableAllowed? – Potential Bug? – Serious defect?
Anomalies Explanationkd kill-define ???dd define-define ???uu use-use ???kk kill-kill ???d ~ define last ???u ~ use last ???k ~ kill last ???
![Page 43: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/43.jpg)
DFT–43
Potential Anomalies – static analysis – 3
Anomalies Explanation~ d first define Allowed – normal casedu define-use Allowed – normal casedk define-kill Potential bug~ u first use Potential bugud use-define Allowed – redefineuk use-kill Allowed – normal case~ k first kill Serious defectku kill-use Serious defect
![Page 44: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/44.jpg)
DFT–44
Potential Anomalies – static analysis – 4
Anomalies Explanationkd kill-define Allowed - redefineddd define-define Potential buguu use-use Allowed - normal casekk kill-kill Serious defectd ~ define last Potential bugu ~ use last Allowed- normal casek ~ kill last Allowed - normal case
![Page 45: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/45.jpg)
DFT–45
Data flow guidelines
When is dataflow analysis good to use?
![Page 46: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/46.jpg)
DFT–46
Data flow guidelines – 2
When is dataflow analysis good to use?
Data flow testing is good for computationally/controlintensive programs
If P-use of variables are computed, then P-use dataflow testing is good
Define/use testing provides a rigorous, systematic wayto examine points at which faults may occur.
![Page 47: Dataflow Testing - eecs.yorku.ca · Dataflow Testing Testing All-Nodes ... alpha 25 51, 123 beta 18, 123, 124 51, 123, 124 gamma 51 25, 51, 124. DFT–6 Dataflow Analysis Can reveal](https://reader033.vdocument.in/reader033/viewer/2022052720/5f09970b7e708231d4278f17/html5/thumbnails/47.jpg)
DFT–47
Data flow guidelines – 3
Aliasing of variables causes serious problems!
Working things out by hand for anything but smallmethods is hopeless
Compiler-based tools help in determining coverage values