实践白盒测试之逻辑覆盖案例.pptx
《实践白盒测试之逻辑覆盖案例.pptx》由会员分享,可在线阅读,更多相关《实践白盒测试之逻辑覆盖案例.pptx(37页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、实践白盒测试之逻辑覆盖案例实践白盒测试之逻辑覆盖案例例子程序:if(a1)&(b=0)x=x/a;if(a=2)|(x1)x=x+1;Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第1页/共36
2、页程序框图(语句覆盖)(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdcEvaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第2页/共36页1.语句覆盖设计若干条测试
3、用例,使程序中每条设计若干条测试用例,使程序中每条可执行语句至少执行一次。可执行语句至少执行一次。用例ABX执行路径Case1aceCase2abe语句覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty
4、Ltd.第3页/共36页1.语句覆盖设计若干条测试用例,使程序中每条设计若干条测试用例,使程序中每条可执行语句至少执行一次。可执行语句至少执行一次。用例ABX执行路径Case1203aceCase2213abe语句覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.
5、Copyright 2004-2011 Aspose Pty Ltd.第4页/共36页Case1:A=2,B=0,X=3(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdc语句覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Cop
6、yright 2004-2011 Aspose Pty Ltd.第5页/共36页Case2:A=2,B=1,X=3(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdc此语句未覆盖此语句未覆盖语句覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pt
7、y Ltd.Copyright 2004-2011 Aspose Pty Ltd.第6页/共36页Case1:A=2,B=0,X=3(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdc错写成错写成OR错写成错写成AND语句覆盖是最弱的覆盖语句覆盖是最弱的覆盖语句覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2
8、.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第7页/共36页程序框图(判定覆盖)(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdcEvaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright
9、 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第8页/共36页 2.判定覆盖(分支覆盖)设计测试用例,使程序中的每个逻辑设计测试用例,使程序中的每个逻辑判断的取真和取假的分支至少经历一判断的取真和取假的分支至少经历一次。次。用例ABX执行路径Case1aceCase3abdEvaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.
10、NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第9页/共36页 2.判定覆盖(分支覆盖)设计测试用例,使程序中的每个逻辑设计测试用例,使程序中的每个逻辑判断的取真和取假的分支至少经历一判断的取真和取假的分支至少经历一次。次。用例ABX执行路径Case1203aceCase3101abdEvaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client P
11、rofile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第10页/共36页第一组:Case1:A=2,B=0,X=3(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdc判定覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client
12、 Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第11页/共36页第二组:Case3:A=1,B=0,X=1(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdc判定覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Clie
13、nt Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第12页/共36页n n 只作到判定覆盖将无法确定只作到判定覆盖将无法确定判定内部条件的错误。判定内部条件的错误。(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdc错写成错写成X1)AND(B=0)(A=2)OR(X1)X=X/AX=X+1eFFTTbdc错写成错
14、写成X1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdcEvaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第15页/共36页3.条件覆盖设计若干测试用例,使程序的设计若
15、干测试用例,使程序的每个判每个判定中的每个条件定中的每个条件的可能取值至少满足的可能取值至少满足一次一次上例中设条件:上例中设条件:A1 T1 A1 T1 F1 F1 B=0 T2 B=0 T2 F2F2 A=2 T3 A=2 T3 F3F3 X1 T4 X1 T4 F4F4取真表为取真表为取假表为取假表为Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profil
16、e 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第16页/共36页n n满足条件覆盖的一组测试用例满足条件覆盖的一组测试用例A B X路径覆盖分支覆盖条件Case6T1 F2 T3 F4Case7F1 T2 F3 T43.3.条件覆盖条件覆盖条件覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slide
17、s for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第17页/共36页n n满足条件覆盖的一组测试用例满足条件覆盖的一组测试用例A B X路径覆盖分支覆盖条件Case6 2 1 1a b eb eT1 F2 T3 F4Case7 1 0 3a b eb eF1 T2 F3 T43.3.条件覆盖条件覆盖条件覆盖Evaluation only.Evaluation only.Created with Aspose.Slides for.N
18、ET 3.5 Client Profile 5.2.0.0.Created with Aspose.Slides for.NET 3.5 Client Profile 5.2.0.0.Copyright 2004-2011 Aspose Pty Ltd.Copyright 2004-2011 Aspose Pty Ltd.第18页/共36页 Case6Case6:A=2,B=1,X=1A=2,B=1,X=1 Case7Case7:A=1,B=0,X=3A=1,B=0,X=3(A1)AND(B=0)(A=2)OR(X1)aX=X/AX=X+1eFFTTbdc 两个测试用例覆盖了四个条件八种可能取
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 实践 测试 逻辑 覆盖 案例
限制150内