软件测试问题及关相数学知识

上传人:无*** 文档编号:172373451 上传时间:2022-12-03 格式:PPT 页数:78 大小:2.28MB
收藏 版权申诉 举报 下载
软件测试问题及关相数学知识_第1页
第1页 / 共78页
软件测试问题及关相数学知识_第2页
第2页 / 共78页
软件测试问题及关相数学知识_第3页
第3页 / 共78页
资源描述:

《软件测试问题及关相数学知识》由会员分享,可在线阅读,更多相关《软件测试问题及关相数学知识(78页珍藏版)》请在装配图网上搜索。

1、软件学院软件学院软件学院软件学院软件学院软件学院1.1 Importance of software testing1.2 Concepts and Glossary软件学院软件学院软件学院软件学院vPurpose:to relay signals from the Mars Polar Lander once it reached the surface of the planetvDisaster:smashed into the planet instead of reaching a safe orbitvWhy:Software bug-failure to convert Engl

2、ish measures to metric values$165M1mile=1609M软件学院软件学院 1988 US Vicennes shot down Airbus 320 Mistook airbus 320 for a F-14 290 people dead Why:Software bug-cryptic and misleading output displayed by the tracking software软件学院软件学院 THERAC-25,a computer controlled radiation-therapy machine 1986:two cance

3、r patients at the East Texas Cancer Center in Tyler received fatal radiation overdoses Why:Software bug-mishandled race condition(i.e.,miscoordination between concurrent tasks)软件学院软件学院vLondon Ambulance Service Computer Aided Dispatch(LASCAD)Purpose:automate many of the human-intensive processes of m

4、anual dispatch systems associated with ambulance services in the UK functions:Call taking Failure of the London Ambulance Service on 26 and 27 November 1992软件学院软件学院 Load increased Emergencies accumulated System made incorrect allocations more than one ambulance being sent to the same incident the cl

5、osest vehicle was not chosen for the emergency At 23:00 on October 28 the LAS eventually instigated a backup procedure,after the death of at least 20 patients软件学院软件学院Software and its Impact:A Quantitative Assessment,by B.W.Boehm,Datamation,19(5),48-59(1973)Errors in medical software have caused deat

6、hs软件学院软件学院 The development of software for ballistic-missile defense,by H.Lin,Scientific American,vol.253,no.6(Dec.1985),p.48 An Air New Zealand airliner crashed into an Antarcticmountain North American Aerospace Defense Command reported that the U.S.was under missile attack;traced to faulty compute

7、r software-generated incorrect signals Manned space capsule Gemini V missed its landingpoint by 100 miles;software ignored the motion ofthe earth around the sun软件学院软件学院 Ghost in the Machine,Time Magazine,Jan.29,1990.p.58 Dallas/Fort Worth air-traffic system began spitting out gibberish in the Fall o

8、f 1989 and controllers had to track planes on paper软件学院软件学院 Software Reliability:Principles&Practice,p.25,by G.J.Myers Apollo 8 spacecraft erased part of thecomputers memory Eighteen errors were detected during the10-day flight of Apollo 14 An error in a single FORTRAN statementresulted in the loss

9、of the first Americanprobe to Venus(金星)软件学院软件学院 ACM SIGSOFT Software Engineering Notes,vol.6,no.2 F-18 fighter plane crashed due to a missingexception condition ACM SIGSOFT Software Engineering Notes,vol.9,no.5 F-14 fighter plane was lost to uncontrollablespin,traced to tactical(战术)software软件学院软件学院软

10、件学院软件学院 NIST study On CNN.com-April 27,2003软件学院软件学院 Cant we expect software to execute correctly?Carefully made programs 5 faults/1000 LOC 1M LOC will have 5000 faults Windows XP has 45M LOC How many faults?45 x 5000=225,000 Why not remove the faults?软件学院软件学院软件学院软件学院“If the automobile industry had d

11、eveloped like the software industry,Who dare to driving the cars that with too many problems”.Yeah,and if cars were like software,they would crash twice a day for noreason,and when you called for service,theyd tell you to reinstall the engine.”软件学院软件学院 User requirements Engine power,all-wheel,seatin

12、g,comfort,MP3 player!Detailed design Blueprints,design documents Verify design Simulation,prototyping Develop parts(components)Test each component Components may be reused Mass produced Assemble the car Test the car(Front/side crash tests,Stability tests)Usability testing(Feedback from drivers/passe

13、ngers)软件学院软件学院软件学院软件学院 Features of many LEGO parts Modularity Reusability Each part can be used in different placesand ways Flexibility of design Compatibility With other LEGO sets Building-blocks软件学院软件学院软件学院软件学院Galvanized Bridge Wire for Parallel WireBridge Cables.Recommended diameter.196 inch.Galv

14、anized Bridge Strand-consists ofseveral bridge wires,of various diameterstwisted together.Galvanized Bridge Rope-consists of sixstrands twisted around a strand core.Parallel Wire CableDetail of Main Cable and Cable Band.The wrappingwire is omitted at the right for clarity.Note theclosed construction

15、 and aluminum fillers.软件学院软件学院软件学院软件学院 Even good design cannot guaranteea perfect product Need testing of all products including software软件学院软件学院Two ways vProcess management CMM,PSP,TSP Engineering processvTesting 软件学院软件学院Matrix operation A+B,AXBYou could easily implement the algorithm.But,is that c

16、orrect?Have you thought all possibilities of Matrix?软件学院软件学院软件学院软件学院Test CaseGenerationEnough?yesnoVerificationTest Coverage软件学院软件学院Test Cases1,3,21,2,33,2,3-1,-2Program Output Just a list.A sorted list.Repeated entry.Empty list.Negative numbers.SPECS:Takes a listof numbers;returns asorted list.软件学院

17、软件学院Test CaseGenerationEnough?yesnoVerificationTest Coverage软件学院软件学院CoverageEvaluatoryesVerifierORTest OracleTest CaseGenerator软件学院软件学院OriginalTestCasesOriginalSoftwareModifiedSoftwareNewTestCasesRegression testing软件学院软件学院 Different Software Types Object-oriented Component-based Concurrent Distribut

18、ed Graphical-user Interfaces Web Different goals of testing Usability Security Correctness Performance 软件学院软件学院软件学院软件学院软件学院软件学院vTesting is a process of executing a program with the intent of finding an error.vA good test is one that has a high probability of finding an as yet undiscovered error.vA s

19、uccessful test is one that uncovers an as yet undiscovered error.vThe objective is to design tests that systematically uncover different classes of errors and do so with a minimum amount of time and effort.软件学院软件学院vDemonstrate that software functions appear to be working according to specification.v

20、That performance requirements appear to have been met.vData collected during testing provides a good indication of software reliability and some indication of software quality.Testing cannot show the absence of defects,it can only show that software defects are present.软件学院软件学院 Question“does program

21、 P obey specification S”is undecidable!Every testing technique embodies some compromise between accuracy and computational cost Facts Inaccuracy is not a limitation of the technique It is theoretically impossible to devise acompletely accurate technique Every practical technique must sacrificeaccura

22、cy in some way软件学院软件学院vThe current development methods of The current development methods of software are:software are:Depend on peopleDepend on peoples intelligences intelligenceSpecification is informal or even chaos Specification is informal or even chaos Software development tools are not self-S

23、oftware development tools are not self-containedcontainedSoftware development process is elective Software development process is elective and without standards on detailand without standards on detail 在当前的软件开发方法学指导下开发软件,软件在当前的软件开发方法学指导下开发软件,软件测试仍是保证软件质量和可靠性的重要手段。测试仍是保证软件质量和可靠性的重要手段。软件学院软件学院 Testing

24、 takes more than 50%ofthe total cost of software development More for critical software Software quality will become thedominant success criterion软件学院软件学院The understanding of software test软件测试:巨大的效益和艰苦的工作并存软件测试:巨大的效益和艰苦的工作并存Exhausted test is impossible to realized.Software test can not ensure to unc

25、over all errors of a software.Software test can not instead of other quality insurance methods软件学院软件学院 if(state=0)if(state=1);软件学院软件学院Int count(int&a,int month_num)int month_income=0,i;for(i=0;i month_num;i+)month_income+=ai;return month_income;/1000ai204 Data is inaccurate Every data type is limite

26、d by its bits.Such as float variable accurate is 7 bit,so 123456799.00 is equal to 123456711.00.软件学院软件学院1.Theory and methods of software test white-box test、black-box test、walk through、formal verification、clean room、fault level;2.Tools and environment of software test Eclipse、JUnit and EMMA 3.Softwa

27、re test project evaluating evaluating the plan of each software test groups4.Standards of software quality and software documentation ISO9000,IEEE,Chinese national standards软件学院软件学院5.Software Test in software development process functional test、structured test、Integrate test、system test、accept test6

28、.Regression Test concept and seminar7.Object-oriented Test 8.The technology development of software test seminar9.Project validation 软件学院软件学院 Fault(缺陷)An incorrect step,process,or data definition in a computer program Error(ISO)(错误)A discrepancy between a computed,observed,or measured value or condi

29、tion and the true,specified,or theoretically correct value or condition Failure(IEEE)(失败)The inability of a system or component to perform its required functions within specified performance requirements软件学院软件学院 Exception(IEEE)(例外/越界)An event that causes suspension of normal program operation.Types

30、include addressing exception,data exception,operation exception,overflow exception,protection exception,underflow exception Anomaly(IEEE)(异常)Anything observed in the documentation or operation of software,that deviates from expectations based on previously verified software products or reference doc

31、uments软件学院软件学院Basic principle of software test(Myers principle)Independent principleCompletive(完全性)principleThe types of software test The concepts of software test软件学院软件学院Basic principle of software test(Myers principle)Early test and continual testAvoid test software by programmer him/her self Tes

32、t case=input data+expected resultTest case should include expected(valid)input data and unexpected(invalid)input dataTest program=what it should to do+what it should not doThe probability of exist errors are direct proportion to the errors have being uncovered.Check each test result roundlySoftware

33、test is an most innovational work软件学院软件学院vSoftware test should be execute Software test should be execute by the group which is by the group which is independent from development independent from development group.group.交互测试交互测试 第三方测试第三方测试软件学院软件学院Complete all test cases according to the Complete all

34、 test cases according to the test plan test plan Use stated test case generate methods.Use stated test case generate methods.Reach expected object(such as coverage Reach expected object(such as coverage criteriacriteria)Draw a curve for analyze,which is show Draw a curve for analyze,which is show th

35、e errors for different time period.the errors for different time period.Should uncover an expected number of Should uncover an expected number of errors.errors.软件学院软件学院For process:For process:Walk through Unit test Integrate test System testFor technique:For technique:Execution-based Verification/No

36、n-execution based Verification,For object:For object:Functional test,Performance test,Reliability test,Security test,Intensity(强度)test,Regression test软件学院软件学院u Design test plan Design test planu Test case generate Test case generate u Establish test environment Establish test environment u Test exec

37、ute Test execute u Evaluate test result Evaluate test result u Complete test documentation:test plan,Complete test documentation:test plan,test explain and test report test explain and test report 软件学院软件学院Test Phases Test Phases a.Walk Through(Non-execution based Verification)b.Unit Test;c.Integrate

38、 Test;d.System Test;e.Acceptable Test;2022-12-358可行性研究需求说明项目初始化需求更新需求分析需求规格说明概要设计设计规格说明详细设计模块设计编码计使用使用软件使用测试验收软件验收测试测过的软件集成测试集成的软件集成测试过的模块模块测试产品结束项目完成测试用例、测试数据测试用例、测试数据测试用例、测试数据测试用例、测试数据测试用例、测试数据集成计划建立文件测试数据测试用例评审评审走查代码阅读代码Prerequisites Mathematics knowledge of software test 集合集合定义:A=元素列表 ;B=元素列表;运算

39、:AB 交集;AB 并集;A补集;A-B=xAxB;AB=(AB)-(AB);(异或)笛卡尔积:AB=:xAyBA是B的子集:AB;A是B的真子集:AB;A=B:ABBA;划分:给定一个集合B,以及B的一组子集A1,A2An,它们是B的一个划分,当且仅当:A1A2An=B,且 AiAj=(ij)定义:给定集合给定集合A和和B,函数函数f是是A B的一个子集的一个子集,使得使得ai、ajA,biA,bi、bjB,f(ai)=bi,f(aj)=bj,bjB,f(ai)=bi,f(aj)=bj,bibibjbjaiaiajaj。或或 f:ABf:AB f f A B上函数,当且仅当上函数,当且仅当f

40、(A)=B;中函数,当且仅当中函数,当且仅当f(A)B;一对一函数:一对一函数:ai、ajA,aiaj f(ai)f(aj);多对一函数:多对一函数:存在存在ai、ajA,aiaj 但但f(ai)=f(aj);给定2个集合A和B,关系R是笛卡尔积A B的一个子集。关系的属性:自反的:当且仅当所有 aA,R;A,R;对称的:当且仅当R R R;R;反对称的:当且仅当、R R a=b;a=b;传递的:当且仅当当且仅当、R R R;R;排序关系:自反、反对称和传递的;(小于等于):自反、反对称和传递的;(小于等于)等价关系:自反、对称和传递的;(同班同学):自反、对称和传递的;(同班同学)命题:是要

41、么为真、要么为假的句子。例子:62、汽车会飞、人是动物 等;而:水很深、山很高、火车很快等就不是命题。命题的逻辑运算:与 :或 :非 :异或:如果则(IF-THEN):p p pq pq T T F T T F T F F T T T F F F T 概率:是期望发生方式的数量,除以总的可能方式概率:是期望发生方式的数量,除以总的可能方式的数量;的数量;例例1:一个袋子中有:一个袋子中有10个红球,个红球,10个兰球;从中任个兰球;从中任取一个球,是红球的几率?取一个球,是红球的几率?再取一个是红球的几率?再取一个是红球的几率?连续连续2个是红球的几率?个是红球的几率?例例2:一副扑克:一副扑

42、克4人打,你拿到人打,你拿到4个个A的概率?的概率?图G=(V,E)由节点的有限集合V和节点无序对偶集合E组成。例1:V=n1,n2,n3,n4,n5;E=(n1,n2),(n1,n4),(n2,n6),(n3,n4),(n4,n5);n1n2n3n4n5n6度度:节点的度是与该节点连接的边数;关联矩阵关联矩阵:节点与边的矩阵;相邻矩阵:相邻矩阵:节点与节点的矩阵;路径:从节点A到节点B的一个边的序列;连通性:A到B有路径;圈数:区域的划分;有向图(如右图)入度(Indeg)出度(Outdeg)n1n5n3n4n6n2有向图的相邻矩阵n1n2n3n4n5n6 n1 0 1 0 100 n200

43、000 1 n3000 100 n40000 10 n5000000 n6000000路径与半路径路径:是一系列首尾相连的边的集合;半路径:两个节点有共同的起点或终点。0-连接,当且仅当ni和nj之间没有路径;1-连接,当且仅当ni和nj之间有一条半路径,但没有路径;2-连接,当且仅当ni和nj之间有一条路径;3-连接,当且仅当ni到nj有一条路径;并且nj到ni有一条路径;强组件 有向图的强组件是3-连接节点的最大集合。将前面的例图修改为如下左图所示:强组件是n3,n4,n5,我们可以将其简化为下右图所示的压缩图;n1n5n3n4n6n2n1s1n6n2 压缩图是结构化软件测试中十分重要的概

44、念,压缩图可以消除环路,因而可以极大地减少测试路径。程序流图是大家都应该熟悉的内容,这里不在介绍和复习。有限(穷)状态机是形式化描述的有效方法,在计算机调度、管理中得到了广泛的应用。我们通过一个简单的例子来说明有穷状态机的基本概念。司机驾驶汽车,有以下状态。打开车门;车挡在启动档,插钥匙,打火发动汽车;挂前进档,汽车前行;挂后退档,汽车后退;挂启动档,熄火,拔钥匙;下车关门。当然,油门和刹车也是两个重要的动作,一个是为了提速,一个是为了减速,但它们都不影响汽车的状态,这里予以简化。空档是一个过渡状态,为了简洁,也予以简化。状态转换图在实际设计中往往被状态转换表所代替,表13-1是汽车驾驶的状态

45、转换表。当前状态当前状态状态状态执行动作执行动作表表13-1 汽车驾驶的状态转换表汽车驾驶的状态转换表 准备状态准备状态启动状态启动状态前进状态前进状态后退状态后退状态(挂启动档)(挂启动档)打火打火启动状态启动状态启动状态启动状态无效无效无效无效挂前进档挂前进档准备状态准备状态前进状态前进状态前进状态前进状态挂后退档挂后退档准备状态准备状态后退状态后退状态后退状态后退状态挂启动挡挂启动挡准备状态准备状态启动状态启动状态启动状态启动状态启动状态启动状态熄火熄火准备状态准备状态准备状态准备状态准备状态准备状态准备状态准备状态从上面的例子我们可以看到,一个有穷状态机包括以下5个部分:状态集J、输入

46、(动作)集K、状态转换函数(转换表)T、初始态S和终止态F。对于上面的例子有穷状态机的各个部分如下:u状态集J:准备状态,启动状态,前进状态,后退状态;u输入集K:打火,熄火,挂前进档,挂后退档,挂启动档;u转换函数T:如表13-1所示;u初始态S:准备状态;u终止态F:准备状态;由上面的说明,我们可以将有穷状态机表示为一个5元组(J,K,T,S,F),其中:J 是一个有穷的非空状态集;K是一个有穷的非空输入集;T是一个从(J-F)K到J的转换函数;S J,是唯一的初始态;F J,是若干个终止态。有穷状态机在计算机系统中应用的十分广泛。如操作系统中的作业调度与管理,GUI图形用户界面的驱动等。对于软件测试而言,并不是仅仅需要本节介绍的数学知识。形式化描述、数学验证、数据结构与算法等都是可能用到的数学。在本课程中,以软件测试的实践为主,不再多介绍数学的知识。

展开阅读全文
温馨提示:
1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
2: 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
3.本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!