《軟件工程-實(shí)踐者的研究方法》chapter-15-cn-傳統(tǒng)軟件測(cè)試_第1頁(yè)
《軟件工程-實(shí)踐者的研究方法》chapter-15-cn-傳統(tǒng)軟件測(cè)試_第2頁(yè)
《軟件工程-實(shí)踐者的研究方法》chapter-15-cn-傳統(tǒng)軟件測(cè)試_第3頁(yè)
《軟件工程-實(shí)踐者的研究方法》chapter-15-cn-傳統(tǒng)軟件測(cè)試_第4頁(yè)
《軟件工程-實(shí)踐者的研究方法》chapter-15-cn-傳統(tǒng)軟件測(cè)試_第5頁(yè)
已閱讀5頁(yè),還剩36頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

第十五章傳統(tǒng)軟件測(cè)試SlideSettoaccompany

SoftwareEngineering:APractitioner’sApproach,7/e

byRogerS.PressmanSlidescopyright?1996,2001,2005,2009

byRogerS.PressmanFornon-profiteducationaluseonlyMaybereproducedONLYforstudentuseattheuniversitylevelwhenusedinconjunctionwithSoftwareEngineering:APractitioner'sApproach,7/e.Anyotherreproductionoruseisprohibitedwithouttheexpresswrittenpermissionoftheauthor.AllcopyrightinformationMUSTappeariftheseslidesarepostedonawebsiteforstudentuse.1編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.測(cè)試的原則原則一:窮盡測(cè)試是不可能的原則二:測(cè)試工作具有創(chuàng)造性和挑戰(zhàn)性原則三:測(cè)試旨在發(fā)現(xiàn)存在的缺陷原則四:測(cè)試是有風(fēng)險(xiǎn)的原則五:測(cè)試需要有計(jì)劃性原則六:測(cè)試需要有獨(dú)立性編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.測(cè)試生存周期測(cè)試計(jì)劃測(cè)試設(shè)計(jì)測(cè)試開(kāi)發(fā)測(cè)試執(zhí)行測(cè)試評(píng)估測(cè)試條件、資源、進(jìn)度設(shè)計(jì)測(cè)試用例(確定怎么測(cè)試)測(cè)試開(kāi)發(fā)(設(shè)計(jì)腳本、樁和驅(qū)動(dòng)模塊等)建立測(cè)試環(huán)境,運(yùn)行被測(cè)程序,執(zhí)行測(cè)試將測(cè)試結(jié)果與期望結(jié)果進(jìn)行比較測(cè)試計(jì)劃、測(cè)試設(shè)計(jì)和測(cè)試開(kāi)發(fā)在軟件開(kāi)發(fā)完成前進(jìn)行測(cè)試執(zhí)行只能在軟件開(kāi)發(fā)完成后進(jìn)行編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.1)測(cè)試計(jì)劃測(cè)試計(jì)劃主要內(nèi)容:測(cè)試目標(biāo)測(cè)試策略測(cè)試參與人員測(cè)試的進(jìn)度安排測(cè)試的系統(tǒng)環(huán)境Review測(cè)試計(jì)劃模板編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.2)測(cè)試設(shè)計(jì)任務(wù):設(shè)計(jì)測(cè)試用例測(cè)試用例(testcase)是按一定順序執(zhí)行的與測(cè)試目標(biāo)相關(guān)的一系列測(cè)試。其主要內(nèi)容包括:測(cè)試輸入(Testinput)期望結(jié)果(ExpectedResults)測(cè)試用例設(shè)計(jì)的兩種通用方法白盒測(cè)試:依據(jù)源代碼黑盒測(cè)試:依據(jù)需求編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.舉例:采用黑盒法設(shè)計(jì)測(cè)試用例一個(gè)加法程序intAdd(inta,intb)的測(cè)試用例測(cè)試輸入(Testinput)輸入a為2,b為3期望結(jié)果(ExpectedResults)輸出結(jié)果為5編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.舉例:采用白盒法設(shè)計(jì)測(cè)試用例語(yǔ)句覆蓋法使得程序中的每一個(gè)語(yǔ)句至少被遍歷一次測(cè)試用例:

A=2,B=0,X=3A>1ANDB=0aYcX=X/ANbYeX=X+1NdA=2ORX>1編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.3)測(cè)試開(kāi)發(fā)任務(wù):開(kāi)發(fā)測(cè)試腳本、樁和驅(qū)動(dòng)模塊TestScipt:Inmanualtesting,theinstructionsonhowtoperformoneormoretestcases,alsooftencalledatestprocedure.Inautomatedtesting,referstothecorrespondingmachine-executableinstructions.TestCase:Asequenceofstepsconsistingofactionstobeperformedonthesystemundertest.(Thesestepsaresometimescalledthetestprocedureortestscript.)Theseactionsareoftenassociatedwithsomesetofdata(preloadedorinputduringthetest).Thecombinationofactionstakenanddataprovidedtothesystemundertestleadstothetestcondition.Thisconditiontendstoproduceresultsthatthetestcancomparewiththeexpectedresults;i.e.,assessqualityunderthegiventestcondition.Theactionscanbeperformedserially,inparallel,orinsomeothercombinationofconsecution.編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.4)測(cè)試執(zhí)行任務(wù):執(zhí)行測(cè)試用例對(duì)于手動(dòng)測(cè)試:測(cè)試者按事先準(zhǔn)備好的手工過(guò)程進(jìn)行測(cè)試,測(cè)試者輸入數(shù)據(jù)、觀察輸出、記錄發(fā)現(xiàn)的問(wèn)題。對(duì)于自動(dòng)測(cè)試:可能只需要啟動(dòng)測(cè)試工具,并告訴工具執(zhí)行哪些測(cè)試用例。編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.5)測(cè)試評(píng)估任務(wù):將測(cè)試結(jié)果與期望輸出進(jìn)行比較,判斷軟件功能是否正確,編寫(xiě)缺陷報(bào)告和測(cè)試記錄軟件缺陷(bug)是對(duì)軟件產(chǎn)品預(yù)期屬性的偏離對(duì)產(chǎn)品需求規(guī)約的偏離對(duì)用戶(hù)期望的偏離,即用戶(hù)要求未體現(xiàn)在需求規(guī)約中軟件做了用戶(hù)不希望做的事(畫(huà)蛇添足)編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.缺陷等級(jí)0級(jí):災(zāi)難性的--系統(tǒng)崩潰、數(shù)據(jù)被破壞1級(jí):很?chē)?yán)重的--數(shù)據(jù)被破壞2級(jí):嚴(yán)重的--特性不能運(yùn)行,無(wú)法替代3級(jí):中等的--特性不能運(yùn)行,可替代4級(jí):煩惱的--提示不正確,報(bào)警不確切5級(jí):輕微的--表面化的錯(cuò)誤,拼寫(xiě)錯(cuò)等編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.缺陷報(bào)告(BugReport)項(xiàng)目名稱(chēng)測(cè)試日期測(cè)試人缺陷等級(jí)缺陷描述編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.回歸測(cè)試為了保證軟件返工時(shí)沒(méi)有引進(jìn)新的錯(cuò)誤,要全部或部分地重復(fù)以前做過(guò)的測(cè)試。編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.終止測(cè)試的標(biāo)準(zhǔn)在測(cè)試計(jì)劃中規(guī)定終止測(cè)試的標(biāo)準(zhǔn)終止測(cè)試的常用標(biāo)準(zhǔn)所有嚴(yán)重的缺陷都已糾正,剩余的缺陷密度少于0.01%100%測(cè)試覆蓋度至少要查出***缺陷數(shù)量1000個(gè)CPU小時(shí)內(nèi)不出錯(cuò)的操作概率大于99.5%編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.TestabilityOperability—itoperatescleanlyObservability—theresultsofeachtestcasearereadilyobservedControllability—thedegreetowhichtestingcanbeautomatedandoptimizedDecomposability—testingcanbetargetedSimplicity—reducecomplexarchitectureandlogictosimplifytestsStability—fewchangesarerequestedduringtestingUnderstandability—ofthedesign15編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.Whatisa“Good”Test?AgoodtesthasahighprobabilityoffindinganerrorAgoodtestisnotredundant.Agoodtestshouldbe“bestofbreed”Agoodtestshouldbeneithertoosimplenortoocomplex16編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.InternalandExternalViewsAnyengineeredproduct(andmostotherthings)canbetestedinoneoftwoways:Knowingthespecifiedfunctionthataproducthasbeendesignedtoperform,testscanbeconductedthatdemonstrateeachfunctionisfullyoperationalwhileatthesametimesearchingforerrorsineachfunction;Knowingtheinternalworkingsofaproduct,testscanbeconductedtoensurethat"allgearsmesh,"thatis,internaloperationsareperformedaccordingtospecificationsandallinternalcomponentshavebeenadequatelyexercised.17編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.TestCaseDesign"Bugslurkincornersandcongregateatboundaries..."BorisBeizerOBJECTIVECRITERIACONSTRAINTtouncovererrorsinacompletemannerwithaminimumofeffortandtime18編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.窮盡測(cè)試——可能嗎?loop<20XThereare10possiblepaths!Ifweexecuteonetestpermillisecond,itwouldtake3,170yearstotestthisprogram!!1419編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.選擇性測(cè)試loop<20XSelectedpath20編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareTestingMethodsStrategieswhite-boxmethodsblack-boxmethods21編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.黑盒測(cè)試和白盒測(cè)試黑盒測(cè)試根據(jù)被測(cè)試程序功能來(lái)進(jìn)行測(cè)試等價(jià)分類(lèi)法邊界值分析法錯(cuò)誤猜測(cè)法白盒測(cè)試以程序結(jié)構(gòu)為依據(jù)的測(cè)試方法邏輯覆蓋法路徑測(cè)試法編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.白盒測(cè)試...我們的目標(biāo)是確保所有的語(yǔ)句與條件至少被執(zhí)行一次。

23編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.為什么需要覆蓋?錯(cuò)誤與路徑執(zhí)行的可能性成反比

我們經(jīng)常確信某個(gè)路徑不會(huì)被執(zhí)行,事實(shí)往往相反。編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.SoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.基本路徑測(cè)試First,wecomputethecyclomaticcomplexity:numberofsimpledecisions+1ornumberofenclosedareas+1Inthiscase,V(G)=425編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.CyclomaticComplexityAnumberofindustrystudieshaveindicatedthatthehigherV(G),thehighertheprobabilityorerrors.V(G)modulesmodulesinthisrangearemoreerrorprone26編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.基本路徑測(cè)試Next,wederivetheindependentpaths:SinceV(G)=4,therearefourpathsPath1:1,2,3,6,7,8Path2:1,2,3,5,7,8Path3:1,2,4,7,8Path4:1,2,4,7,2,4,...7,8Finally,wederivetestcasestoexercisethesepaths.1234567827編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.BasisPathTestingNotesyoudon'tneedaflowchart,butthepicturewillhelpwhenyoutraceprogrampathscounteachsimplelogicaltest,compoundtestscountas2ormorebasispathtestingshouldbeappliedtocriticalmodules28編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.DerivingTestCasesSummarizing:Usingthedesignorcodeasafoundation,drawacorrespondingflowgraph.Determinethecyclomaticcomplexityoftheresultantflowgraph.Determineabasissetoflinearlyindependentpaths.Preparetestcasesthatwillforceexecutionofeachpathinthebasisset.

29編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.控制結(jié)構(gòu)測(cè)試條件測(cè)試—atestcasedesignmethodthatexercisesthelogicalconditionscontainedinaprogrammodule數(shù)據(jù)流測(cè)試

—selectstestpathsofaprogramaccordingtothelocationsofdefinitionsandusesofvariablesintheprogram30編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.DataFlowTestingThedataflowtestingmethod[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'31編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.LoopTestingNestedLoopsConcatenatedLoopsUnstructuredLoopsSimpleloop32編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.LoopTesting:SimpleLoopsMinimumconditions—SimpleLoops1.skiptheloopentirely2.onlyonepassthroughtheloop3.twopassesthroughtheloop4.mpassesthroughtheloopm<n5.(n-1),n,and(n+1)passesthroughtheloopwherenisthemaximumnumberofallowablepasses33編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.LoopTesting:NestedLoopsStartattheinnermostloop.Setallouterloopstotheirminimumiterationparametervalues.Testthemin+1,typical,max-1andmaxfortheinnermostloop,whileholdingtheouterloopsattheirminimumvalues.Moveoutoneloopandsetitupasinstep2,holdingallotherloopsattypicalvalues.Continuethisstepuntiltheoutermostloophasbeentested.Iftheloopsareindependentofoneanotherthentreateachasasimpleloopelse*treatasnestedloopsendif*forexample,thefinalloopcountervalueofloop1isusedtoinitializeloop2.NestedLoopsConcatenatedLoops34編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.Black-BoxTestingrequirementseventsinputoutput35編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.Black-BoxTestingHowisfunctionalvaliditytested?Howissystembehaviorandperformancetested?Whatclassesofinputwillmakegoodtestcases?Isthesystemparticularlysensitivetocertaininputvalues?Howaretheboundariesofadataclassisolated?Whatdataratesanddatavolumecanthesystemtolerate?Whateffectwillspecificcombinationsofdatahaveonsystemoperation?36編輯pptSoftwareEngineering:APractitioner’sApproach,7/e(McGraw-Hill2009).Slidescopyright2009byRogerPressman.黑盒測(cè)試

等價(jià)分類(lèi)法(equivalencepartitioning)把輸入數(shù)據(jù)的可能值劃分為若干等價(jià)類(lèi)

有效等價(jià)類(lèi)和無(wú)效等價(jià)類(lèi)每一無(wú)效等價(jià)類(lèi)至少需要一個(gè)測(cè)試用例

例子某工廠公開(kāi)招工,規(guī)定報(bào)名者年齡應(yīng)在16周歲至35周歲之間(到2008年3月止)即出生年月不在上述范圍內(nèi),將拒絕接受,并顯示

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論