Software Quality Assurance课件.ppt

上传人(卖家):三亚风情 文档编号:3184520 上传时间:2022-07-30 格式:PPT 页数:155 大小:811KB
下载 相关 举报
Software Quality Assurance课件.ppt_第1页
第1页 / 共155页
Software Quality Assurance课件.ppt_第2页
第2页 / 共155页
Software Quality Assurance课件.ppt_第3页
第3页 / 共155页
Software Quality Assurance课件.ppt_第4页
第4页 / 共155页
Software Quality Assurance课件.ppt_第5页
第5页 / 共155页
点击查看更多>>
资源描述

1、 SOFTWARE ENGINEERINGCodeGenerationSoftwareTestingSoftwareDesign SOFTWARE ENGINEERING 软件质量保证(SQA)应该从产品的计划和设计开始,直到投入使用和售后服务的软件生存周期的每一个阶段中的每一个步骤,每一个有关的人,包括软件开发人员、测试人员、项目经理、销售人员和用户都必须严把质量关,只有这样才能保证软件的高质量,这就是现代软件质量保证的基本策略。SOFTWARE ENGINEERING 测试是软件生命周期中的一个重要阶段。它直接影响着软件的质量和软件的可靠性。因此,人们往往花费了大量的时间和人力用于软件测试

2、。在软件开发的全过程中,尽管对每个阶段均有严格的技术审查,但是,要发现所有的错误是不可能的。因此,软件在投入生产性运行之前要尽可能多地发现软件中的差错,以提高软件的质量。SOFTWARE ENGINEERING 一旦编码开始,正式测试必须随即开始。测试要求开发者首先抛弃“刚开发的软件是正确的”这一先入为主的观念,然后努力去构造测试用例来“破坏”软件。神话:若我们确实擅长编程,就应当不会有错误。SOFTWARE ENGINEERING 测试不应该被看作是安全网 只有在软件体系结构完成后,独立的测试组(ITG)才介入 任何测试策略都必须包含测试计划测试用例设计、测试执行及测试结果数据的收集与评估

3、测试是可以事先计划并可以系统地进行的一系列活动 SOFTWARE ENGINEERING The importance of software testing and its implications with respect to software quality cannot be overemphasized.Software testing is a critical element of software quality assurance and represents the ultimate review of specification,design,and coding.SO

4、FTWARE ENGINEERING 开发人员应该意识到:所有的错误都是严重的,不存在微不足道的错误。这样才能少犯错误。错误的分类是技术性的。如:手册错误可能导致机毁人亡。假设某个财务软件有两个错误:错误A使该系统死机,错误B导致工资计算错误。按分类,错误A比错误B严重。但事实上B要比A严重。SOFTWARE ENGINEERING In fact,testing is the one step in the software engineering process that could be viewed(psychologically,at least)as destructive rat

5、her than constructive.Software developer are by their nature constructive people.错觉:“程序编完后,研制工作就接近尾声了”。实际:“测试占开发费用的40%至50%,对有关生命危险的软件甚至占80%”SOFTWARE ENGINEERING测试可靠性模型纠错评价软件配置测试配置测试结果错误改正预期的结果错误率数据预测的可靠性测试必须按照软件需求和设计阶段所制订的测试计划进行,其结果以“测试分析报告”的形式提交。回归测试测试计划文档的一部分 SOFTWARE ENGINEERING到目前为止,证明软件百分之百正确是不

6、可能的,而且进行穷举测试也是不可能的。你永远也不能完成测试。因此我们的测试策略是在一定的开发周期和某种经济条件下,通过有限的测试以尽可能多地发现错误。按软件工程中的402040规则(编程工作占开发工作的20%,编程前-计划、需求分析、概要设计和详细设计,和编程后-测试的工作量各占开发工作的40%)。测试在整个软件的开发中必须占40%左右的工作量。各类测试在测试总工作量所占的比例根据具体项目及开发人员的配置情况而定。SOFTWARE ENGINEERING依照测试工作量及下述标准可判定是否可以结束测试过程:1)如果测试没有发现错误,说明测试失败,则必须更换测试人员作进一步测试。2)如果有规律地出

7、现一些严重的,需要修改设计的错误,则说明软件的质量和可靠性存在问题,必须重写相应模块,甚至整个软件。3)如果软件功能正常,发现的错误容易纠正,则说明软件的质量和可靠性可接受(不排除测试不充分的可能)。SOFTWARE ENGINEERING1.Testing is a process of executing a program with the intent of finding an error.2.A good test case is one that has a high proba-bility of finding an as-yet undiscovered error.3.A

8、 successful test is one that uncovers an as-yet undiscovered error.Testing cannot show the absence of defects,it can only show that software errors are present.SOFTWARE ENGINEERING 理解测试的目的是个很重要的意识问题。如果说测试的目的是为了说明程序中没有缺陷,那么测试人员就会向这个目标靠拢,因而下意识地选用一些不易暴露错误的测试示例。这样的测试是虚假的。目前的科技成果鉴定会普遍存在类似的虚假现象。尽管已经明白了测试的

9、目的是为了发现尽可能多的缺陷,但当测试人员真的发现了一堆缺陷时,却不可乐颠颠地跑去恭喜那个倒霉的开发者,否则会打架的。SOFTWARE ENGINEERING 测试有助于提高软件的质量,但是提高软件的质量不能依赖于测试。测试与质量的关系很象在考试中“检查”与“成绩”的关系。学习好的学生,在考试时通过认真检查能减少因疏忽而造成的答题错误,从而“提高”了考试成绩(取得他本来就该得的好成绩)。而学习差的学生,他原本就不会做题目,无论检查多么细心,也不能提高成绩。软件的高质量是设计出来的,而不是靠测试修补出来的。SOFTWARE ENGINEERING1.All tests should be tra

10、ceable to customer requirements.2.Tests should be planed long before testing begins.3.The Pareto principle applies to software testing.Stated simply,the Pareto principle implies that 80 percent of all errors uncovered during testing will likely be traceable to 20 percent of all program modules.SOFTW

11、ARE ENGINEERING4.Testing should begin“in the small”and progress toward testing“in the large.”5.Exhaustive testing is not possible.6.To be most effective,testing should be conducted by an independent third party.SOFTWARE ENGINEERING程序员或程序设计机构不应测试自己设计的程序;测试用例设计不仅要有确定的输入数据,而且要有确定的、详尽的预期输出数据;测试用例设计不仅要有合

12、理的输入数据,还要有不合理的输入数据;除了检查程序是否做完了它应做的事之外,还要检查它是否做了不应做的事;保留全部测试用例,并作为软件配置的组成部分之一;程序中存在错误的概率与该段程序中已经发现的错误数成正比。SOFTWARE ENGINEERING Operability:“The better it work,the more efficiently it can be tested.”Observability:“What you see is what you test.”Controllability:“The better we can control the software,t

13、he more the testing can be automated and optimized.”SOFTWARE ENGINEERING Decomposability:“By controlling the scope of testing,we can more quickly isolate problems and perform smarter retesting.”Simplicity:“The less there is to test,the more quickly we can test it.”Stability:“The fewer the changes,th

14、e fewer the disruptions to testing.”Understandability:“The more information we have,the smarter we will test.”SOFTWARE ENGINEERING A good test has a high probability of finding an error.A good test is not redundant.A good test should be“best of breed.”The test that has the highest likelihood of unco

15、vering a whole class of errors should be used.A good test should be neither too simple nor too complex.SOFTWARE ENGINEERING 测试分为如下的几类:1)模块测试(单元测试、分调、单调)2)组装测试(整体测试、集成测试、联调)3)有效性测试(确认测试)4)系统(组装、集成)测试 5)并行测试(平行测试、双轨制运行)6)测试、测试7)验收测试(接收测试):由用户完成 此外部分测试可能需要进行回归测试。SOFTWARE ENGINEERING模块测试确认测试组装测试模块模块测试模块

16、测试模块模块系统测试设计信息经装配好 的软件测试过的模块软件需求确认过的软件其他系统元素可运行的系统软件试运行、验收 SOFTWARE ENGINEERING系统定义需求分析详细设计组装测试模块测试确认测试系统测试验收测试软件计划概要设计编码研制是一个自顶向下逐步细化的过程,而测试则是按相反顺序的集成过程。SOFTWARE ENGINEERING测试方法和测试技术静态技术动态技术桌前检查代码会审黑盒测试步行检查白盒测试路径测试条件测试数据测试循环测试等价类划分边界值分析比较测试 SOFTWARE ENGINEERING 三角形问题:接受3个1100之间的整数,判别由这3条边构成的三角形的类型:

17、等边、等腰、不等边或非三角形。NextDate函数:接受3个整数,输出非法日期或输入日期的下一个日期。佣金问题:销售商根据不同的销售额可以获得不同的奖励。SOFTWARE ENGINEERING 检查逻辑设计和编码错误。不涉及程序的实际执行,用人工进行分析。1)桌前检查(Desk Check):程序员自己检查程序效果不太理想。解决办法:互相交换程序检查。2)代码会审(Code Inspections):由一组人通过阅读、讨论和争议,对程序进行静态分析的过程。3)步行检查(Walkthroughs):预先准备测试数据,让与会者充当“计算机”一检查程序的状态。有时比真正运行程序可能发现更多的错误。

18、SOFTWARE ENGINEERING 在程序的测试中,十全十美的测试情况是不存在的,即任何程序的测试都是不彻底的,测试不能发现程序中的所有错误。在测试方法中,最简单的,也是最差的一种测试方法是随机输入的测试。这种将随机选择的输入值作为输入数据的测试往往检测不出较多的错误。通常,在程序的测试中采用二类方法:黑盒法和白盒法。SOFTWARE ENGINEERING 无论是白盒法还是黑盒法,关键都是如何选择高效的测试用例(高效的测试用例是指一个用例能够覆盖尽可能多的测试情况,从而提高测试效率)。Black-box testing alludes to test that are conducte

19、d at the software interface.White-box testing of software is predicated on close examination of procedural detail.SOFTWARE ENGINEERING 由于无法进行穷举测试,所以测试用例(test case)的设计在软件测试中起很重要的作用。测试用例设计的基本目的是确定一组最有可能发现某个错误或某类错误的测试数据。测试用例的设计技术有许多种。如:路径测试,各种逻辑覆盖(语句、条件、循环等),等价类划分,边界值分析,因果图和程序图等图形技术。SOFTWARE ENGINEERIN

20、G White-box testing,sometimes called glass-box testing,is a test case design method that uses the control structure of the procedural design to derive test cases.白盒法检查程序的内部结构,即检测程序的逻辑。SOFTWARE ENGINEERING Using white-box testing methods,the software engineer can derive test cases that(1)guarantee th

21、at all independent paths within a module have been exercised at least once;(2)exercise all logical decision on their true and false sides;(3)execute all loops at their boundaries and within their operational bounds;and(4)exercise internal data structures to assure their validity.SOFTWARE ENGINEERING

22、 The basic path method enables the test designer to derive a logical complexity measure of a procedural design and use this measure as a guide for defining a basic set of execution paths.Test cases derived to exercise the basic set are guaranteed to execute every statement in the program at least on

23、e time during testing.SOFTWARE ENGINEERINGSequenceIf-then-elseCaseWhileUntilFlow graph Notation SOFTWARE ENGINEERINGTranslating Flow chart and PDL to a flow graph.2,3987614,51011R1R4R3R2NodeEdgeRegion SOFTWARE ENGINEERING McCabe认为程序的复杂性很大程度上取决于程序控制流的复杂性。Cyclomatic(环路)Complexity is a software metric

24、that provides a quantitative measure of the logical complexity of a program.Cyclomatic complexity has a foundation in graph theory and provides us with an extremely useful software metric.SOFTWARE ENGINEERING Complexity is computed in one of three ways:1)The number of regions of flow graph correspon

25、d to the cyclomatic complexity.2)Cyclomatic complexity,V(G),for a flow graph G is define as V(G)=Edge-Node+2.3)cyclomatic complexity,V(G),for a flow graph G is also define as V(G)=P+1,where P is the number of predicate nodes contained in the flow graph G.SOFTWARE ENGINEERING Cyclomatic complexity fo

26、r example can be computed:1)The flow graph has 4 regions.2)V(G)=11edges-9nodes+2=43)V(G)=3 predicate nodes+1=4测试工作量和潜在错误的个数与V(G)成正比McCabe认为在一个模块内 V(G)一般应控制在10以内,当V(G)在3至9之间时被认为是良好的结构和恰当的复杂性(度)。SOFTWARE ENGINEERING The value computed for cyclomatic complexity defines the number of independent paths I

27、 the basic set of a program and provide us with an upper bound for the number of the tests that must be conducted to ensure that all statements have been executed at least once.SOFTWARE ENGINEERING An independent path is any path through the program that introduces at least one new set of processing

28、 statements or a new condition.When stated in terms of a flow graph,an independent path must move along at least edge that has not been traversed before the path is defined.SOFTWARE ENGINEERING A set of independent paths for example:Path 1:1-11 Path 2:1-2-3-4-5-10-1-11 Path 3:1-2-3-6-8-9-10-1-11 Pat

29、h 4:1-2-3-6-7-9-10-1-11 The path 1-2-3-4-5-10-1-2-3-6-8-9-10-1-11is not considered to be an independent path.SOFTWARE ENGINEERING The basic path testing method can be applied to a procedural design or to source code.1)Using the design or code as a foundation,draw a corresponding flow graph.2)Determi

30、ne the cyclomatic complexity of the resultant flow graph.3)Determine a basic set of linearly independent paths.4)Prepare test cases that will force execution of each path in the basic set.SOFTWARE ENGINEERING 白盒法又称为逻辑覆盖法,因为要以程序(模块)内部的逻辑结构为基础来设计测试用例,主要用于单元测试。语句覆盖判定覆盖条件覆盖判定条件覆盖条件组合覆盖弱强 SOFTWARE ENGINE

31、ERING Condition testing is a test case design method that exercises the logical conditions contained in a program module.The condition testing method focuses on testing each condition in the program.条件测试包括四类覆盖:判定覆盖、条件覆盖、判定/条件覆盖、条件的组合覆盖 SOFTWARE ENGINEERING开始X=X/A A1 AND B=0结束 X=X+1 A=2 OR X1YY被测试的程序

32、的流程图aedcbNN SOFTWARE ENGINEERING 判定覆盖又称作分支覆盖,它是使程序中的每个判定至少出现一次“真值”和一次“假值”,即程序中的每个分支至少经过一次。对此,我们可以设计如下测试数据对判定逻辑进行覆盖:A=3,B=0,X=1(通过路径acd)A=2,B=1,X=3(通过路径abe)SOFTWARE ENGINEERING 条件覆盖是判定中的每个条件的所有可能的结果至少出现一次,并且使每条语句(不是每个分支)至少执行一次(语句覆盖)。对此,条件覆盖的测试可由下面两组数据进行:A=2,B=0,X=4(通过路径ace)A=1,B=1,X=1(通过路径abd)条件覆盖一般情

33、况下比判定覆盖要强。SOFTWARE ENGINEERING 但是,也有例外的情况(如果,测试数据设计得不好的话),例如下例所示:IF A1 AND B=0 中,若设计一组条件覆盖的测试数据如下:A=2,B=1 A=1,B=0 则这组数据满足条件覆盖,但不会执行IF语句中的THEN的子句。SOFTWARE ENGINEERING 设计下面两组数据:A=1,B=0,X=3 A=2,B=1,X=1 满足条件覆盖(四个条件:A1,B=0,A=2,X1均取过“真”值和“假”值)但它们都通过路径abe,所以不满足判定覆盖。SOFTWARE ENGINEERING 判定/条件覆盖方式是使判定中每个条件的所

34、有可能结果至少出现一次。而每个判定本身所有的可能结果也至少出现一次。下面两组数据满足判定/条件覆盖:A=2,B=0,X=4(通过路径ace)A=1,B=1,X=1(通过路径abd)SOFTWARE ENGINEERING 条件的组合覆盖所设计的测试数据使每个判定中的条件的各种组合至少出现一次,并且每条语句至少执行一次。例子中条件的所有可能组合有8种:A1,b0 A2,X1A1,b0 A2,X1A1,b0 A2,X1A1,b0 A2,X1 SOFTWARE ENGINEERING 要测试上述8种组合(满足条件组合覆盖),可设计下述4组数据:A=2,B=0,X=4 覆盖A=2,B=1,X=1 覆盖

35、A=1,B=0,X=2 覆盖A=1,B=1,X=1 覆盖 但上述的4组测试数据并没有覆盖所有的每一条路径(路径acd未通过)。SOFTWARE ENGINEERINGThe data flow testing method selects test paths of a program according to the location of definition and uses of variables in the program.One simple data flow testing strategy is to require that every DU chain be cove

36、red at least once.We refer to this strategy as the DU testing strategy.It has been shown that DU testing does not guaranteed to be coverage of all branches of a program.SOFTWARE ENGINEERING Loop testing is a white-box testing technique that focuses exclusively on the validity of loop constructs.Four

37、 different classes of loops can be defined:simple loops,concatenated loops,nested loops,and unstructured loops.SOFTWARE ENGINEERING The following set of tests should be applied to simple loops.1)Skip the loop entirely.2)Only one pass through the loop.3)Two passes through the loop.4)M passes through

38、the loop where mn.5)n-1,n,n+1 passes through the loop.Where n is the maximum number of allowable passes through the loop.SOFTWARE ENGINEERING Beizer suggests an approach that will help to reduce the number of tests:1.Start at the innermost loop.Set all other loops to minimum values.2.Conduct simple

39、loop tests for the innermost loop while holding the outer loops at their minimum iteration parameter(e.g.,loop counter)values.Add other tests for out-of range or excluded values.SOFTWARE ENGINEERING3.Work outward,conducting tests for the next loop,but keeping all other outer loops at minimum values

40、and other nested loops to“typical”values.4.Continue until all loops have been tested.SOFTWARE ENGINEERING Concatenated loops can be tested using the approach defined above for simple loops if each of the loops is independent of the other.When the loops are not independent,the approach applied to nes

41、ted loops is recommended.SOFTWARE ENGINEERING Whenever possible,this class of loops should be redesigned to reflect the use of the structured programming constructs.SOFTWARE ENGINEERING黑盒法是把测试对象看作一个黑盒,测试时完全不考虑程序的内部的逻辑结构与内部特性,只需根据需求规格说明书,测试程序的功能或程序的外部特性。因此黑盒法又称为功能测试或数据驱动测试。常用的测试方法有:等价分类法边值分析法错误推测法因果图

42、法软件输入输出 SOFTWARE ENGINEERINGBlack-box testing focuses on the functional requirements of the software.That is,black-box testing enables the software engineer to derive sets of input conditionals that will fully exercise all functional requirements for a program.Black-box testing is not an alternative

43、 to white-box techniques.Rather,it is a complementary approach that is likely to uncover a different class of errors than white-box methods.SOFTWARE ENGINEERING Black-box testing attempts to find errors in the following categories:1)Incorrect or missing functions;2)Interface errors;3)Errors in data

44、structures or external data base access;4)Performance errors;and5)Initialization and termination errors.SOFTWARE ENGINEERING Unlike white-box testing,which is performed early in the testing process,black-box testing terns to be applied during later stages of testing.Because black-box testing purpose

45、ly disregards control structure,attention is focused on the information domain.SOFTWARE ENGINEERINGTests are designed to answer the following questions:How is functional validity tested?What classes of input will make good test cases?Is the system particularly sensitive to certain input values?How a

46、re the boundaries of a data class isolated?What data rates and data volume can the system tolerate?What effect will specific combinations of data have on system operation?SOFTWARE ENGINEERING The first step in black-box testing is to understand the objects that are modeled in software and the relati

47、onships that connect these objects.Once this has been accomplished,the next step is to define a series of tests that verify“all objects have the expected relationship to one another.”SOFTWARE ENGINEERING Stated in another way,software testing begins by creating a graph of important objects and their

48、 relationships and then devising a series of tests that will cover the graph so that each object and relationship is exercised and errors are uncovered.SOFTWARE ENGINEERING Equivalence partitioning is a black-box testing method that divides the input domain of a program into classes of data from whi

49、ch test cases can be derived.Equivalence partitioning strives to define a test case that uncovers classes of errors,thereby reducing the total number of test cases that must be developer.SOFTWARE ENGINEERING Test case design for equivalence partitioning is based on an evaluation of equivalence class

50、es for an input condition.Equivalence classes may be defined according to the following guidelines:1)If an input condition specifies a range,one valid and two invalid equivalence classes are defined.SOFTWARE ENGINEERING2)If an input condition requires a specific value,one valid and two invalid equiv

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 办公、行业 > 各类PPT课件(模板)
版权提示 | 免责声明

1,本文(Software Quality Assurance课件.ppt)为本站会员(三亚风情)主动上传,163文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。
2,用户下载本文档,所消耗的文币(积分)将全额增加到上传者的账号。
3, 若此文所含内容侵犯了您的版权或隐私,请立即通知163文库(发送邮件至3464097650@qq.com或直接QQ联系客服),我们立即给予删除!


侵权处理QQ:3464097650--上传资料QQ:3464097650

【声明】本站为“文档C2C交易模式”,即用户上传的文档直接卖给(下载)用户,本站只是网络空间服务平台,本站所有原创文档下载所得归上传人所有,如您发现上传作品侵犯了您的版权,请立刻联系我们并提供证据,我们将在3个工作日内予以改正。


163文库-Www.163Wenku.Com |网站地图|