




已阅读5页,还剩36页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill 2009 Slidescopyright2009byRogerPressman 1 第十五章 传统软件测试 SlideSettoaccompanySoftwareEngineering APractitioner sApproach 7 ebyRogerS PressmanSlidescopyright 1996 2001 2005 2009byRogerS PressmanFornon profiteducationaluseonlyMaybereproducedONLYforstudentuseattheuniversitylevelwhenusedinconjunctionwithSoftwareEngineering APractitioner sApproach 7 e Anyotherreproductionoruseisprohibitedwithouttheexpresswrittenpermissionoftheauthor AllcopyrightinformationMUSTappeariftheseslidesarepostedonawebsiteforstudentuse 测试的原则 原则一 穷尽测试是不可能的原则二 测试工作具有创造性和挑战性原则三 测试旨在发现存在的缺陷原则四 测试是有风险的原则五 测试需要有计划性原则六 测试需要有独立性 测试生存周期 测试计划 测试设计 测试开发 测试执行 测试评估 测试条件 资源 进度 设计测试用例 确定怎么测试 测试开发 设计脚本 桩和驱动模块等 建立测试环境 运行被测程序 执行测试 将测试结果与期望结果进行比较 测试计划 测试设计和测试开发在软件开发完成前进行测试执行只能在软件开发完成后进行 1 测试计划 测试计划主要内容 测试目标测试策略测试参与人员测试的进度安排测试的系统环境Review测试计划模板 2 测试设计 任务 设计测试用例测试用例 testcase 是按一定顺序执行的与测试目标相关的一系列测试 其主要内容包括 测试输入 Testinput 期望结果 ExpectedResults 测试用例设计的两种通用方法白盒测试 依据源代码黑盒测试 依据需求 举例 采用黑盒法设计测试用例 一个加法程序intAdd inta intb 的测试用例测试输入 Testinput 输入a为2 b为3期望结果 ExpectedResults 输出结果为5 举例 采用白盒法设计测试用例 语句覆盖法使得程序中的每一个语句至少被遍历一次测试用例 A 2 B 0 X 3 3 测试开发 任务 开发测试脚本 桩和驱动模块TestScipt Inmanualtesting theinstructionsonhowtoperformoneormoretestcases alsooftencalledatestprocedure Inautomatedtesting referstothecorrespondingmachine executableinstructions TestCase Asequenceofstepsconsistingofactionstobeperformedonthesystemundertest Thesestepsaresometimescalledthetestprocedureortestscript Theseactionsareoftenassociatedwithsomesetofdata preloadedorinputduringthetest Thecombinationofactionstakenanddataprovidedtothesystemundertestleadstothetestcondition Thisconditiontendstoproduceresultsthatthetestcancomparewiththeexpectedresults i e assessqualityunderthegiventestcondition Theactionscanbeperformedserially inparallel orinsomeothercombinationofconsecution 4 测试执行 任务 执行测试用例对于手动测试 测试者按事先准备好的手工过程进行测试 测试者输入数据 观察输出 记录发现的问题 对于自动测试 可能只需要启动测试工具 并告诉工具执行哪些测试用例 5 测试评估 任务 将测试结果与期望输出进行比较 判断软件功能是否正确 编写缺陷报告和测试记录软件缺陷 bug 是对软件产品预期属性的偏离对产品需求规约的偏离对用户期望的偏离 即用户要求未体现在需求规约中软件做了用户不希望做的事 画蛇添足 缺陷等级 0级 灾难性的 系统崩溃 数据被破坏1级 很严重的 数据被破坏2级 严重的 特性不能运行 无法替代3级 中等的 特性不能运行 可替代4级 烦恼的 提示不正确 报警不确切5级 轻微的 表面化的错误 拼写错等 缺陷报告 BugReport 项目名称测试日期测试人缺陷等级缺陷描述 回归测试 为了保证软件返工时没有引进新的错误 要全部或部分地重复以前做过的测试 终止测试的标准 在测试计划中规定终止测试的标准终止测试的常用标准所有严重的缺陷都已纠正 剩余的缺陷密度少于0 01 100 测试覆盖度至少要查出 缺陷数量1000个CPU小时内不出错的操作概率大于99 5 TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 15 Testability Operability itoperatescleanlyObservability theresultsofeachtestcasearereadilyobservedControllability thedegreetowhichtestingcanbeautomatedandoptimizedDecomposability testingcanbetargetedSimplicity reducecomplexarchitectureandlogictosimplifytestsStability fewchangesarerequestedduringtestingUnderstandability ofthedesign TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 16 Whatisa Good Test AgoodtesthasahighprobabilityoffindinganerrorAgoodtestisnotredundant Agoodtestshouldbe bestofbreed Agoodtestshouldbeneithertoosimplenortoocomplex TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 17 InternalandExternalViews Anyengineeredproduct andmostotherthings canbetestedinoneoftwoways Knowingthespecifiedfunctionthataproducthasbeendesignedtoperform testscanbeconductedthatdemonstrateeachfunctionisfullyoperationalwhileatthesametimesearchingforerrorsineachfunction Knowingtheinternalworkingsofaproduct testscanbeconductedtoensurethat allgearsmesh thatis internaloperationsareperformedaccordingtospecificationsandallinternalcomponentshavebeenadequatelyexercised TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 18 TestCaseDesign Bugslurkincorners andcongregateat boundaries BorisBeizer OBJECTIVE CRITERIA CONSTRAINT touncovererrors inacompletemanner withaminimumofeffortandtime TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 19 穷尽测试 可能吗 loop 20X Thereare10possiblepaths Ifweexecuteone testpermillisecond itwouldtake3 170yearsto testthisprogram 14 TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 20 选择性测试 loop 20X Selectedpath TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 21 SoftwareTesting Methods Strategies white boxmethods black boxmethods 黑盒测试和白盒测试 黑盒测试根据被测试程序功能来进行测试等价分类法边界值分析法错误猜测法白盒测试以程序结构为依据的测试方法逻辑覆盖法路径测试法 TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 23 白盒测试 我们的目标是确保所有的语句与条件至少被执行一次 TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 为什么需要覆盖 错误与路径执行的可能性成反比 我们经常确信某个路径不会被执行 事实往往相反 TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 25 基本路径测试 First wecomputethecyclomatic complexity numberofsimpledecisions 1 or numberofenclosedareas 1 Inthiscase V G 4 TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 26 CyclomaticComplexity Anumberofindustrystudieshaveindicated thatthehigherV G thehighertheprobability orerrors V G modules modulesinthisrangeare moreerrorprone TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 27 基本路径测试 Next wederivethe independentpaths SinceV G 4 therearefourpaths Path1 1 2 3 6 7 8 Path2 1 2 3 5 7 8 Path3 1 2 4 7 8 Path4 1 2 4 7 2 4 7 8 Finally wederivetest casestoexercisethese paths TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 28 BasisPathTestingNotes TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 29 DerivingTestCases Summarizing Usingthedesignorcodeasafoundation drawacorrespondingflowgraph Determinethecyclomaticcomplexityoftheresultantflowgraph Determineabasissetoflinearlyindependentpaths Preparetestcasesthatwillforceexecutionofeachpathinthebasisset TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 30 控制结构测试 条件测试 atestcasedesignmethodthatexercisesthelogicalconditionscontainedinaprogrammodule数据流测试 selectstestpathsofaprogramaccordingtothelocationsofdefinitionsandusesofvariablesintheprogram TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 31 DataFlowTesting Thedataflowtestingmethod Fra93 selectstestpathsofaprogramaccordingtothelocationsofdefinitionsandusesofvariablesintheprogram Assumethateachstatementinaprogramisassignedauniquestatementnumberandthateachfunctiondoesnotmodifyitsparametersorglobalvariables ForastatementwithSasitsstatementnumberDEF S X statementScontainsadefinitionofX USE S X statementScontainsauseofX Adefinition use DU chainofvariableXisoftheform X S S whereSandS arestatementnumbers XisinDEF S andUSE S andthedefinitionofXinstatementSisliveatstatementS TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 32 LoopTesting NestedLoops ConcatenatedLoops Unstructured Loops Simpleloop TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 33 LoopTesting SimpleLoops Minimumconditions SimpleLoops 1 skiptheloopentirely 2 onlyonepassthroughtheloop 3 twopassesthroughtheloop 4 mpassesthroughtheloopm n 5 n 1 n and n 1 passesthrough theloop wherenisthemaximumnumber ofallowablepasses TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 34 LoopTesting NestedLoops Startattheinnermostloop Setallouterloopstotheir minimumiterationparametervalues Testthemin 1 typical max 1andmaxforthe innermostloop whileholdingtheouterloopsattheir minimumvalues Moveoutoneloopandsetitupasinstep2 holdingall otherloopsattypicalvalues Continuethisstepuntil theoutermostloophasbeentested Iftheloopsareindependentofoneanother thentreateachasasimpleloop else treatasnestedloops endif forexample thefinalloopcountervalueofloop1is usedtoinitializeloop2 NestedLoops ConcatenatedLoops TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 35 Black BoxTesting requirements events input output TheseslidesaredesignedtoaccompanySoftwareEngineering APractitioner sApproach 7 e McGraw Hill2009 Slidescopyright2009byRogerPressman 36 Black BoxTesting Howisfunctionalvaliditytested Howissystembehaviorandperformancetested Whatclassesofinputwillmakegoodtestcases Isthesystemparticularlysensitivetocertaininputvalues Howaretheboundariesofadataclassisolated Whatdataratesanddatavolumecanthesystemtolerate Whateffectwillspecificcombinationsofdatahaveonsystemoperation 黑盒测试 等价分类法 equivalencepartitioning 把输入数据的可能值划分为若干等价类有效等价类和无效等价类每一无效等价类至少需要一个测试用例例子某工厂公开招工 规定报名者年龄应在16周岁至35周岁之间 到2008年3月止 即出生年月不在上述范围内 将拒绝接受 并显
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 安全灭火器考试题及答案
- 2025年房地产投资策略报告:城市圈房地产市场分化深度解析
- 2025年工业互联网平台光通信技术升级下的光纤通信网络设备能效优化报告
- 2025至2030年中国钨钼制品市场运行动态及行业投资潜力预测报告
- 2025至2030年中国泛文娱产业市场评估分析及发展前景调研战略研究报告
- 推拿治疗学复习试题附参考答案详解(巩固)
- 有用的企业面试题库及一套参考答案详解
- 2025年度汽车租赁合同租赁车辆租赁期满退租及处理补充协议
- 2025版建筑废弃物再生利用施工合同
- 2025年度物流仓储三方物业租赁管理合同
- 中介拍卖合同协议书范本
- DB34T 5137-2025电化学储能液冷系统设计技术要求
- 旧房拆除重建协议书
- 法医物证课件法医植物学
- 2025-2030年中国电力电容器行业市场经营管理及未来前景展望报告
- 中国儿童维生素A、维生素D临床应用专家共识(2024)解读课件
- 中医院医疗业务科室综合目标考核方案
- JJF 2223-2025氡子体测量仪校准规范
- 防爆知识培训教学课件
- 食品工业生产流程规范
- 云南省昭通市镇雄县2025年数学三下期末质量检测模拟试题含解析
评论
0/150
提交评论