软件测试相关度量.ppt
《软件测试相关度量.ppt》由会员分享,可在线阅读,更多相关《软件测试相关度量.ppt(66页珍藏版)》请在三一办公上搜索。
1、1,Software Metrics,Lecture 10Software Test Metrics,清 华 大 学 软 件 学 院2004年5月11日,2,COCOMO,where a,b,c and d depend on the development mode.,Organic modeSemi-detached modeEmbedded mode,Basic model Intermediate modelAdvanced model,3,COCOMO:Basic,The Basic COCOMO,development time cannot be predicted at thi
2、s stage.,4,COCOMO:Intermediate,The Intermediate COCOMO:,5,COCOMO II,Application Composition E=OP/PROD Early Design model E=2.45 KLOC EAFPost-Architecture model,6,Putnams SLIM,7,Test ConceptsEstimating Number of Test Case&Allocating Test Times Test Coverage MetricsRemaining Defects Metrics,Contents,8
3、,Section 1Test Concepts,9,防不胜防的软件错误 例1:1963年,美国,飞往火星的火箭爆炸,损失$10 million.原因:FORTRAN循环 DO 5 I=1,3 误写为 DO 5 I=1.3,软件测试是保证软件质量的关键步骤,是对软件规格说明、设计和编码的最后复审,其工件量约占总工作量40%以上(对于人命关天的情况,测试相当于其它部分总成本的3 5倍),Roles of Software Testing,10,What is software testing,“Testing is the process ofexecuting a program with th
4、eintent of finding errors.”Glen Myers,11,Software Testing Objectives,Needing minimum effort and timeShowing that software functions work according to specification,It cannot show absence of errors or defects.It can only show that errors are present,Uncovering different cases of errors,12,1:5-10 Main
5、frames i.e.,1 tester for every 5 to 10 developers 2:3 Microsoft,19922:1 Lotus(for 1-2-3 Windows)1:2 Average of 4 major companies,1992Microsoft,Borland,WordPerfect,Novell,Tester-to-developer ratios,13,What is a test case?,A set of test inputs,execution conditions,and expected results developed for a
6、particular objective,14,A test is made up of(many)test casesA test procedure is the detailed instructions for setting up,starting,monitoring and restarting a given test case.a.k.a test plana test case may be used in more than one test procedurea test case may include many subtests,What is a test?,15
7、,Test,test case,test case,test case,subtest,subtest,subtest,subtest,What is a test?(cont.),16,Testing Methodology,White-box,Black-box,17,Objective:Cover the software structure,Structural(White-Box)Test Criteria,Criteria based oncontrol flowdata flowMetric:percentage of coverage achievedAdequacy base
8、d on metric requirements for criteria,18,Graph representation of control flow and data flow relationships,Flow Graphs,Control FlowThe partial order of statement execution,as defined by the semantics of the languageData FlowThe flow of values from definitions of a variable to its uses,19,Statement Co
9、verage Branch Coverage Condition Coverage Basis Path Coverage All-Edges Coverage All-Paths Coverage,White-Box Test,20,123456789101112131415,function P return INTEGER isbeginX,Y:INTEGER;READ(X);READ(Y);while(X 10)loopX:=X 10;exit when X=10;end loop;if(Y 20 and then X mod 2=0)thenY:=Y+20;elseY:=Y 20;e
10、nd if;return 2*X+Y;end P;,A Sample Program to Test,21,2,3,4,5,6,9,10,12,14,T,T,F,F,9,T,F,7,T,F,9a,9b,Ps Control Flow Graph(CFG),22,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,At least 2 test cases needed,(X=20,Y=10)(X=20,Y=30),All-Statements Coverage of P,23,minimum level coverage using structural testingmay
11、 be impossible to achieve 100%statement coveragecode only executed in exceptional or dangerous circumstancescode that is unreachable,Statement Testing:weaknesses,24,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,At least 2 test cases needed,(X=20,Y=10)(X=15,Y=30),All-Branches Coverage of P,25,Branch Testing:wea
12、knesses,Branch testing is one level up from statement testing in degree of coveragesame problem in achieving 100%coverage,26,2,3,4,5,6,9b,10,12,14,T,T,F,F,9a,T,F,7,T,F,At least 3 test cases needed,(X=20,Y=20)5T,7T,9aF,9bT(X=15,Y=10)5T,7F,9aT,9bF(X=9,Y=10)5F,7F,9aT,9bF,Condition Coverage of P,X 10X=1
13、0Y 20X mod 2=0,27,Condition Coverage,Generate test data such that all conditions in a decision take on both outcomes(if possible)at least onceMay not achieve branch coverage:consider while(x 20)x=0 causes first true,second falsex=34 causes first false,second true,28,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,
14、F,Basic-paths Coverage of P,cyclomatic complexity:V(G)=e-n+2,29,2,3,4,5,6,10,12,14,T,F,9,T,F,7,T,F,4 test cases needed,(X=10,Y=10)(X=10,Y=20)(X=20,Y=10)(X=15,Y=10),Basic-paths Coverage of P,30,Basis path testing:Strengths/weaknesses,Basis set is easy to computethe technique is readily applicable to
15、both structured and unstructured programsDrawback:the basis set is not unique;there will be obvious paths omittedDrawback:the number of paths in the basis set can greatly exceed the number necessary to achieve branch coverage,31,2,3,4,5,6,9b,10,12,14,T,T,F,F,9a,T,F,7,T,F,At least 3 test cases needed
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 软件 测试 相关 度量
链接地址:https://www.31ppt.com/p-6434317.html