【文档说明】《软件工程-实践者的研究方法》chapter_14_cn_软件测试策略课件.ppt,共(31)页,1.014 MB,由小橙橙上传
转载请保留链接:https://www.ichengzhen.cn/view-44934.html
以下为本文档部分文字说明:
TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill,2009).Slidescopyrigh
t2009byRogerPressman.1第十四章软件测试策略SlideSettoaccompanySoftwareEngineering:APractitioner’sApproach,7/ebyRogerS.PressmanSlidescopyright©1
996,2001,2005,2009byRogerS.PressmanFornon-profiteducationaluseonlyMaybereproducedONLYforstudentuseattheuniversitylevelwhenusedinconjunctionwithSoftwa
reEngineering:APractitioner'sApproach,7/e.Anyotherreproductionoruseisprohibitedwithouttheexpresswrittenperm
issionoftheauthor.AllcopyrightinformationMUSTappeariftheseslidesarepostedonawebsiteforstudentuse.Theseslides
aredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.2软件测试测试是在程
序发布给最终用户之前,执行程序以发现错误的过程。.TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2
009byRogerPressman.3测试展示了错误需求一致性性能质量TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyrigh
t2009byRogerPressman.4测试的策略性方法为完成有效的测试,软件团队应该进行有效的、正式的技术评审。通过评审,许多错误可以在测试开始之前排除。测试开始于构件层,然后向外“延伸”到整个基于计算机系统的集成。不同的测试技术适用于不同的时间点。测试由软件
开发人员和(对大型项目而言)独立的测试组执行。测试和调试是不同的活动,但任何测试策略中都必须包括调试。TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach
,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.5验证与确认(V&V)验证是指确保软件正确地实现某一特定功能的一系列活动。确认则指的是确保开
发的软件可追溯到用户需求的另外一系列活动。[BOE81]用另一种方式说明了这两者的区别:验证:我们在正确地构造产品吗?确认:我们在构造正确的产品吗?TheseslidesaredesignedtoaccompanySoftwa
reEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.6由谁来测试软件?开
发者独立的测试人员Understandsthesystembut,willtest"gently"and,isdrivenby"delivery"Mustlearnaboutthesystem,but,willattempttobreakitand,isdrivenbyqualit
yTheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009b
yRogerPressman.7测试策略系统工程分析模型设计模型编码单元测试集成测试确认测试系统测试TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGr
aw-Hill2009).Slidescopyright2009byRogerPressman.8测试策略测试从“小规模”开始,进展到“大规模”。传统软件测试关注测试单个构件或相关的一小组构件构件集
成测试面向对象软件的测试测试目标就是在现实的时间范围内利用可控的工作量尽可能多地找到错误。对于面向对象软件,尽管这个基本目标是不变的,但面向对象软件的本质特征改变了测试策略和测试战术。Theseslidesa
redesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2
009byRogerPressman.9StrategicIssues早在开始测试之前,就要以量化的方式规定产品需求。明确地陈述测试目标了解软件的用户并为每类用户建立用户轮廓。建立强调”快速周期测试“的测试计划。建立能够测试自身的“健壮”软件测试之前,利用有效的正
式技术评审作为过滤器。实施正式技术评审以评估测试策略和测试用例本身。为测试过程建立一种持续的改进方法。TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill
2009).Slidescopyright2009byRogerPressman.10单元测试测试模块测试用例结果软件工程师TheseslidesaredesignedtoaccompanySoftwareEngineering:AP
ractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.11单元测试接口局部数据结构边界条件独立路径错误处理路径测试模块测试用例Theseslidesaredesignedtoa
ccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.12单元测试环境被测模块桩
模块桩模块驱动程序结果接口局部数据结构边界条件独立路径错误处理路径测试用例TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e
(McGraw-Hill2009).Slidescopyright2009byRogerPressman.13集成测试策略Options:•the“bigbang”approach•anincrementalconstructionstrategyTheseslidesaredesignedtoa
ccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressma
n.14自顶向下集成topmoduleistestedwithstubsstubsarereplacedoneatatime,"depthfirst"asnewmodulesareintegrated,somesubsetoftestsisre-runABCDEFGTh
eseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.15自底向上集成d
riversarereplacedoneatatime,"depthfirst"workermodulesaregroupedintobuildsandintegratedABCDEFGclusterThesesli
desaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPres
sman.16混合方式测试TopmodulesaretestedwithstubsWorkermodulesaregroupedintobuildsandintegratedABCDEFGclusterThesesli
desaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.17回归测
试回归测试是重新执行已进行测试的某个子集,以确保变更没有传播不期望的副作用。软件发生变更时,软件配置的某些方面(程序、文档或支持数据)也发生变更。回归测试有助于保证变更(由于测试或其他原因)不引入无意识行为或额外的错误。回归测试可以手工进行,方法是重新
执行所有测试用例的子集,或者利用捕捉、回放工具自动进行。TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill
2009).Slidescopyright2009byRogerPressman.18SmokeTestingAcommonapproachforcreating“dailybuilds”forproductsoftwareSmoketestingste
ps:Softwarecomponentsthathavebeentranslatedintocodeareintegratedintoa“build.”•Abuildincludesalldatafiles,
libraries,reusablemodules,andengineeredcomponentsthatarerequiredtoimplementoneormoreproductfunctions
.Aseriesoftestsisdesignedtoexposeerrorsthatwillkeepthebuildfromproperlyperformingitsfunction.•Theintentshouldbetouncover“showstoppe
r”errorsthathavethehighestlikelihoodofthrowingthesoftwareprojectbehindschedule.Thebuildisintegratedwithotherbuildsandtheen
tireproduct(initscurrentform)issmoketesteddaily.•Theintegrationapproachmaybetopdownorbottomup.Theseslidesarede
signedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.19冒烟测试一种常用的集成测试方
法本质上冒烟测试方法包括下列活动:将已经转换为代码的软件构件集成到构建中。设计一系列测试以暴露影响构建正确完成其功能的错误。每天将该构建与其他构建及整个软件产品集成起来进行冒烟测试。TheseslidesaredesignedtoaccompanyS
oftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.20面向对象软件的测试
测试策略基于线程的测试,集成响应系统的一个输入或事件所需的一组类。每个线程单独地集成和测试。应用回归测试以确保没有副效应产生。基于使用的测试,通过测试很少使用服务类(如果有的话)的那些类(称之为独立类)开始构造系统,面向对象软件的类
测试等同于传统软件的单元测试。不同的是传统软件的单元测试侧重于模块的算法细节和穿过模块接口的数据,面向对象软件的类测试是由封装在该类中的操作和类的状态行为驱动的。TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitione
r’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.21BroadeningtheViewof“Testing”Itcanbearguedthatt
hereviewofOOanalysisanddesignmodelsisespeciallyusefulbecausethesamesemanticconstructs(e.g.,classes,attributes,operations,messages)appearatthean
alysis,design,andcodelevel.Therefore,aprobleminthedefinitionofclassattributesthatisuncoveredduringanalysiswillci
rcumventsideeffectsthatmightoccuriftheproblemwerenotdiscovereduntildesignorcode(oreventhenextiteration
ofanalysis).TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009by
RogerPressman.22TestingtheCRCModel1.RevisittheCRCmodelandtheobject-relationshipmodel.2.InspectthedescriptionofeachCRCindexcardt
odetermineifadelegatedresponsibilityispartofthecollaborator’sdefinition.3.Inverttheconnectiontoensurethateachcollaboratorthatis
askedforserviceisreceivingrequestsfromareasonablesource.4.Usingtheinvertedconnectionsexaminedinstep3,determinewhetherotherc
lassesmightberequiredorwhetherresponsibilitiesareproperlygroupedamongtheclasses.5.Determinewhetherwidelyre
questedresponsibilitiesmightbecombinedintoasingleresponsibility.6.Steps1to5areappliediterativelytoeachclassandthrougheachevolution
oftheanalysismodel.TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).S
lidescopyright2009byRogerPressman.23高阶测试确认测试关注软件需求系统测试关注系统集成Alpha/Beta测试关注用户使用恢复测试通过各种方式强制地让系统发生故障
,并验证其能适当恢复安全测试验证建立在系统内的保护机制是否能够实际保护系统不受非法入侵压力测试要求以非正常的数量、频率或容量的方式执行系统性能测试测试软件在集成环境中的运行性能Theseslidesaredesigned
toaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPr
essman.24调试:诊断的过程TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRoge
rPressman.25诊断过程TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRo
gerPressman.26调试工作确定问题原因所花费的时间纠正错误和回归测试需要的时间TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/
e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.27问题&线索问题线索症状与原因出现的地方可能相隔很远;症状可能在另一个错误被改正时(暂时)消失症状实际上可能是由非错误因素引
起的;症状可能是由不易追踪的人为错误引起的;症状可能是由计时问题而不是处理问题引起的;症状可能时有时无;TheseslidesaredesignedtoaccompanySoftwareEngineeri
ng:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.28Bugs带来的后果damagemildannoyingdisturbingseriousextremec
atastrophicinfectiousBugTypeBugCategories:function-relatedbugs,system-relatedbugs,databugs,codingbugs,designbugs,documentatio
nbugs,standardsviolations,etc.TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Sli
descopyright2009byRogerPressman.29调试技术蛮干调试法回溯法原因排除法TheseslidesaredesignedtoaccompanySoftwareEngineering:APractitioner
’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.30纠正错误这个错误的原因在程序的另一部分也产生过吗?大多数情况下,程序额错误是由错误的逻辑模式
引起的,这种逻辑模式可能会在别的地方出现。进行修改可能引发的“下一个错误”是什么?在改正错误之前,应该仔细考虑源代码(最好包括设计)以评估逻辑与数据结构之间的耦合。为避免这个错误,我们首先应当做什么呢?这个问题是建立在统计软件质量保证方法的第一步。Theseslidesar
edesignedtoaccompanySoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.31FinalThoughtsThink--be
foreyouacttocorrectUsetoolstogainadditionalinsightIfyou’reatanimpasse,gethelpfromsomeoneelseOnceyoucorrectthebug,useregressiontestingtoun
coveranysideeffects