CS/CE/SE 6367 Softwre Testing, Vlidtion nd Verifiction Lecture 4 Code Coverge (II)
2/54 Lst Clss Code coverge Control-flow coverge Sttement coverge Brnch coverge Pth coverge Coverge Collection Tools EclEmm
3/54 This Clss Code coverge Dt-flow coverge All-Defs All-Uses All-DU-Pths All-P-Uses/Some-C-Uses All-C-Uses/Some-P-Uses All-P-Uses All-C-Uses
4/54 Motivtion t1 t2 Are t1 nd t2 identicl? lthough the pths re the sme, different tests my hve different vrible vlues defined/used Bsic ide: Control-flow grph Existing control-flow coverge criteri only consider the execution pth (structure) In the progrm pths, which vribles re defined nd then used should lso be covered (dt) A fmily of dtflow criteri is then defined, ech providing different degree of dt coverge
5/54 Dtflow Coverge Considers how dt gets ccessed nd modified in the system nd how it cn get corrupted Common ccess-relted bugs Using n undefined or uninitilized vrible Dellocting or reinitilizing vrible before it is constructed, initilized, or used Deleting collection object leving its members unccessible (grbge collection helps here) Uninitilized... List l; l.dd("1");... Exception in thred "min" jv.lng.nullpointerexception t dtflow.temp.min(temp.jv:21)
6/54 Vrible Definition A progrm vrible is DEFINED whenever its vlue is modified: on the left hnd side of n ssignment sttement e.g., y = 17 in n input sttement e.g., red(y) s n cll-by-reference prmeter in subroutine cll e.g., updte(x, &y);
7/54 Vrible Use A progrm vrible is USED whenever its vlue is red: on the right hnd side of n ssignment sttement e.g., y = x+17 s n cll-by-vlue prmeter in subroutine or function cll e.g., y = sqrt(x) in the predicte of brnch sttement e.g., if ( x > 0 ) { }
8/54 Vrible Use: p-use nd c-use Use in the predicte of brnch sttement is predicteuse or p-use Any other use is computtion-use or c-use For exmple, in the progrm frgment: if ( x > 0 ) { } print(y); There is p-use of x nd c-use of y
9/54 Vrible Use A vrible cn lso be used nd then re-defined in single sttement when it ppers: on both sides of n ssignment sttement e.g., y = y + x s n cll-by-reference prmeter in subroutine cll e.g., increment( &y )
10/54 More Dtflow Terms nd Definitions A pth is definition cler ( def-cler ) with respect to vrible v if it hs no vrible re-definition of v on the pth A complete pth is pth whose initil node is entry node nd whose finl node is n exit node p1 p2 p3 red(x,v); if(x>0) x=v+1; v=v+1; p1 is def-cler for v, while p2 is not p1, p2 re not complete, while p3 is return x+v Control-flow grph
11/54 Definition-Use Pir (DU-Pir) A definition-use pir ( du-pir ) with respect to vrible v is pir (d,u) such tht d is node defining v u is node or edge using v when it is p-use of v, u is n outgoing edge of the predicte sttement there is def-cler pth with respect to v from d to u def d no def for v c-use u c-use exmple def p-use d no def for v u p-use exmple
12/54 DU-Pir: Exmple 1 1. input(a,b) if (B>1) { input(a,b) if(b>1) B>1 2. A = A+7 } B<=1 A=A+7 3. if (A>10) { 4. B = A+B if(a>10) A>10 } A<=10 B=A+B 5. output(a,b) output(a,b)
13/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
14/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
15/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
16/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
17/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
18/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
19/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
20/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
21/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
22/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
23/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
24/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)
25/54 Identifying DU-Pirs Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a,b) B>1 A=A+7 A>10 B=A+B
26/54 Identifying DU-Pirs Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a,b) B>1 A=A+7 A>10 B=A+B
27/54 Dtflow Test Coverge Criteri All-Defs for every progrm vrible v, t lest one def-cler pth from every definition of v to t lest one c-use or one p-use of v must be covered
28/54 Dtflow Test Coverge Criteri Consider test cse executing pth: t1: <1,2,3,4,5> Identify ll def-cler pths covered (i.e., subsumed) by this pth for ech vrible Are ll definitions for ech vrible ssocited with t lest one of the subsumed def-cler pths?
29/54 Def-Cler Pths subsumed by <1,2,3,4,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>
30/54 Def-Cler Pths Subsumed by <1,2,3,4,5> for Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a, B>1 A=A+7 A>10 B=A+B
31/54 Dtflow Test Coverge Criteri Since <1,2,3,4,5> covers t lest one def-cler pth from every definition of A or B to t lest one c-use or p-use of A or B, All-Defs coverge is chieved
32/54 Dtflow Test Coverge Criteri All-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every c-use nd every p-use (including ll outgoing edges of the predicte sttement) of v must be covered Requires tht ll du-pirs covered Consider dditionl test cses executing pths: t2: <1,3,4,5> t3: <1,2,3,5> Do ll three test cses provide All-Uses coverge?
33/54 Def-Cler Pths Subsumed by <1,3,4,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>
34/54 Def-Cler Pths Subsumed by <1,3,4,5> for Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a, B>1 A=A+7 A>10 B=A+B
35/54 Def-Cler Pths Subsumed by <1,2,3,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>
36/54 Def-Cler Pths Subsumed by <1,2,3,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>
37/54 Def-Cler Pths Subsumed by <1,2,3,5> for Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a, B>1 A=A+7 A>10 B=A+B
38/54 Dtflow Test Coverge Criteri None of the three test cses covers the du-pir (1,<3,5>) for vrible A, All-Uses Coverge is not chieved
39/54 DU-Pir: More Complicted Exmple 1. input(x,y) 2. while (Y>0) { 3. if (X>0) 4. Y := Y-X else 5. input(x) 6. } 7. output(x,y) input(x,y) while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 Y:=Y-X input(x) n6 } n7 output(x,y)
40/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y
41/54 du-pir Identifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> input(x,y) while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 Y:=Y-X input(x) n6 n7 } output(x,y
42/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y
43/54 ()* mens will be repeted for >=1 times du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y
44/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y
du-pir Identifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> Infesible! input(x,y) while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 Y:=Y-X input(x) n6 n7 } output(x,y 45/54 Note tht the definition of dupir does not require the existence of fesible def-cler pth from d to u
46/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y
47/54 More Dtflow Terms nd Definitions A pth (either prtil or complete) is simple if ll edges within the pth re distinct, i.e., different A pth is loop-free if ll nodes within the pth re distinct, i.e., different
48/54 Simple nd Loop-Free Pths pth Simple? Loop-free? <1,3,4,2> <1,2,3,2> <1,2,3,1,2> <1,2,3,2,4>
49/54 DU-Pth A pth <,,...,nj,nk> is du-pth with respect to vrible v, if v is defined t node nd either: there is c-use of v t node nk nd <,,...,nj,nk> is def-cler simple pth, or there is p-use of v t edge <nj,nk> nd <,,...nj> is def-cler loop-free pth. NOTE!
50/54 Identifying DU-Pths du-pir pth(s) du-pth? (5,4) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5>
51/54 Another Dtflow Test Coverge Criterion All-DU-Pths: for every progrm vrible v, every du-pth from every definition of v to every c-use nd every p-use of v must be covered p1 2 def 1 3 p2 p1 stisfies ll-defs nd ll-uses, but not ll-du-pths p1 nd p2 together stisfy ll-du-pths 4 c-use node 1 is the only def node, nd 4 is the only use node for v
52/54 More Dtflow Test Coverge Criteri All-P-Uses/Some-C-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every p-use of v must be covered If no p-use of v is vilble, t lest one def-cler pth to c-use of v must be covered All-C-Uses/Some-P-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every c-use of v must be covered If no c-use of v is vilble, t lest one def-cler pth to p-use of v must be covered
53/54 More Dtflow Test Coverge Criteri (2) All-P-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every p-use of v must be covered All-C-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every c-use of v must be covered
54/54 Summry Pth Coverge All-DU-Pths All-Uses All-P-Uses/Some-C-Uses All-C-Uses/Some-P-Uses All-P-Uses All-Defs All-C-Uses Brnch Coverge Sttement Coverge
55/54 Suggested Redings Sndr Rpps nd Eline J. Weyuker. Selecting Softwre Test Dt Using Dt Flow Informtion. IEEE Trnsctions on Softwre Engineering, 11(4), April 1985, pp. 367-375. http://ieeexplore.ieee.org/stmp/stmp.jsp? tp=&rnumber=1702019 P. Frnkl nd E. Weyuker. An Applicble Fmily of Dt Flow Testing Criteri. IEE Trnsction on softwre eng., vol.14, no.10, October 1988. E. Weyuker. The evlution of Progrm-bsed softwre test dt dequcy criteri. Communiction of the ACM, vol.31, no.6, June 1988. Softwre Testing: A Crftsmn s Approch.2nd CRC publiction, 2002
56/54 Thnks