




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
Topic:
SoftwareTestingTechniques(3)INSTRUCTOR:SHULIUHITSCHOOLOFSOFTWARE2017Allrightsreserved1SQAandTestingSoftwareTestingTechniquesBlack-BoxTestingWhite-BoxTestingDD-PathStatementCoverageTestingDD-PathTestingLoopCoverageTestingBasisPathTestingBottom-upTestingTop-downTestingSandwichTestingExamples:TheTriangleProblemTheNextDateFunctionTheCommissionProblemGray-BoxTestingSoftwareTestingTechniques2SQAandTestingWhite-BoxTestingWhite-boxtestdesignallowsonetopeekinsidethe"box",thetesterexaminestheinternalstructureoftheprogramorsystem.Testerfocusesspecificallyonusinginternalknowledgeofthesoftwaretoguidetheselectionoftestdatawithoutconcernfortheprogramorsystemrequirements.Synonymsforwhite-boxinclude:structural,glass-box,clear-box,andopen-box.SoftwareTestingTechniques3SQAandTestingWhite-BoxTestingInwhite-boxtestingtestconditionsaredesignedbyexaminingpathsorlogic.Thetesterknowstheinternalprogramstructureandlogic,justasacarmechanicknowstheinnerworkingsofanautomobile.Forwhite-boxtesting,thetestcasescannotbedetermineduntilthecodehasactuallybeenwritten.
Examples:basispathtesting,statementcoverage,DD-Pathtesting,etc..SoftwareTestingTechniques4SQAandTestingDD-Path(決策到?jīng)Q策-路徑)(1)DD-Path:Decision-to-DecisionPathDD-Pathreferstoasequenceofstatementsthatbeginswiththe“outway”ofadecisionstatementandendswiththe“inway”ofthenextdecisionstatement.Nointernalbranchesoccurinsuchasequence,sothecorrespondingcodeislikearowofdominoes(多米諾牌)linedupsothatwhenthefirstfalls,alltherestinthesequencefall.SoftwareTestingTechniques5SQAandTestingDD-Path(決策到?jīng)Q策-路)(2)PathchainTheinitialandterminalnodesaredistinctEveryinteriornodehasindegree=1andoutdegree=1Thelengthofthechainis?SoftwareTestingTechniquesInitialNodeTerminalNodeInteriorNode6SQAandTestingDD-Path(決策到?jīng)Q策-路徑)(3)ADD-Pathisachaininaprogramgraphsuchthat:Case1:itconsistsofasinglenodewithindeg=0Case2:itconsistsofasinglenodewithoutdeg=0Case3:itconsistsofasinglenodewithindeg>=2or outdeg>=2Case4:itconsistsofasinglenodewithindeg=1and outdeg=1Case5:itisamaximalchainoflength>=1SoftwareTestingTechniques7SQAandTestingTheTriangleProblemThetriangleprogramacceptsthreeintegers,a,b,andcasinput.Thesearetakentobesidesofatriangle.Theintegersa,b,andcmustsatisfythefollowingconditions:SoftwareTestingTechniquesC1:1=<a=<200C4:a<b+cC2:1=<b=<200C5:b<a+cC3:1=<c=<200C6:c<a+bTheoutputoftheprogramisthetypeoftriangledeterminedbythethreesides:Equilateral,Isosceles,scalene,orNotATriangle.8SQAandTesting1.Programtriangle2.a,b,cAsInteger//Datadeclaration3.c1,c2,c3,IsATriangleAsBoolean//Datadeclaration//Step1:GetInput4.Output(“Enter3integerswhicharesidesofatriangle”)5.Input(a,b,c)6.Output(“SideAis”,a)7.Output(“SideBis”,b)8.Output(“SideCis”,c)//Step2:IsATriangle?9.If(a<(b+c))AND(b<(a+c))AND(c<(a+b))10. ThenIsATriangle=True11. ElseIsATriangle=False12.EndIf//Step3:DetermineTriangleType13.IfIsATriangle14. ThenIf(a=b)AND(b=c)15. ThenOutput(“Equilateral”)16. ElseIf(a<>b)AND(b<>c)AND(c<>d)17. ThenOutput(“Scalene”)18. ElseOutput(“Isosceles”)19. EndIf20. EndIf21. ElseOutput(“NotaTriangle”)22.EndIf
23.Endoftriangleprogram9SQAandTesting1211104956781514211319181716202223Programgraphofthetriangleprogram10SQAandTestingEDCfirstBIHGFMLKJNOlastADD-Pathgraphforthetriangleprogram11SQAandTestingDD-Path(決策到?jīng)Q策-路徑)(4)DD-Pathenableveryprecisedescriptionsoftestcoverage.Oneofthefundamentallimitationsoffunctionaltestingisthatitisimpossibletoknoweithertheextentofredundancyorthepossibilityofgapscorrespondingtothewayasetoffunctionaltestcasesexercisesaprogram.SoftwareTestingTechniques12SQAandTestingStructuredProgrammingConstructs
(結(jié)構(gòu)化程序設(shè)計構(gòu)造)
SoftwareTestingTechniquesSequencePre-testLoopPost-test-LoopIf-ThenIf-Then-ElseCase13SQAandTestingStatementCoverageTesting
(語句覆蓋測試)Statementcoverageisawhite-boxtestingtechniqueStatementcoveragetestingensureseverystatementorlineofcode(LOC)isexecuted.Inanotherwords,whenaprogramisexecuteditensuresthateverynodeoftheprogramgraphistraversedatleastonce.Let’strytheTriangleexample…SoftwareTestingTechniques14SQAandTestingEDCfirstBIHGFMLKJNOlastADD-PathgraphforthetriangleprogramTestCaseStatementCoverageTestingPathCase1.FirstABDEFGOlastCase2.FirstABCEFHINOlastCase3.FirstABCEFHJKMNOlastCase4.FirstABCEFHJLMNOlast15SQAandTestingDD-PathgraphTestCaseStatementCoverageTestingPathCase1.FirstABCGlastCase2.FirstABEFGlastCase3.FirstADEFGLastCase4.FirstADFGlastADBEGCFfirstlast16SQAandTestingDD-PathTesting
(決策到?jīng)Q策-路徑測試)DD-Pathtestingisawhite-boxtestingtechniqueWhenaprogramisexecuteditensuresthateveryedgeintheDD-Pathgraphistraversedatleastonce.Forif-thenandif-then-elsestatements,thismeansthatboththetrueandthefalsebranchesarecovered.ForCASEstatements,eachclauseiscovered.Let’strytheTriangleexampleagain…SoftwareTestingTechniques17SQAandTestingEDCfirstBIHGFMLKJNOlastADD-PathgraphforthetriangleprogramTestCaseDD-PathTestingCase1.FirstABDEFGOlastCase2.FirstABCEFHINOlastCase3.FirstABCEFHJKMNOlastCase4.FirstABCEFHJLMNOlast18SQAandTestingDD-PathgraphTestCaseDD-PathTestingCase1.FirstABCGlastCase2.FirstABEFGlastCase3.FirstABCBCGlastCase4.FirstADEFGLastCase5.FirstADFGlastADBEGCFfirstlast19SQAandTestingNestedLoopABCDfirstlastABCDfirstlastABCDfirstlastConcatenatedLoopKnottedLoopsConcatenatedloopsaresimplyasequenceofdisjointloops.NestedloopsaresuchthatoneiscontainedinsideanotherKnottedLoops(Horribleloops)20SQAandTestingLoopCoverageTesting
(循環(huán)覆蓋測試)Loopsareahighlyfault-proneportionofsourcecode.Thesimpleviewoflooptestingisthateveryloopinvolvesadecision,andweneedtotestbothoutcomesofthedecision:OneistotraversetheloopOneistoexit(ornotenter)theloopWecanalsotakeamodifiedboundaryvalueapproach,wheretheloopindexisgivenitsminimum,nominal,andmaximumvalues.EvenpushtorobustnesstestingSoftwareTestingTechniques21SQAandTestingLoopCoverageTesting
(循環(huán)覆蓋測試)Oncealoophasbeentested,thetestercondensesitintoasinglenode.Ifloopsarenested,thisprocessisrepeatedstartingwiththeinnermostloopandworkingoutward.SoftwareTestingTechniquesSkiptheloopentirelyOnlyonepassthroughtheloopTwopassesthroughtheloopMpassesthroughtheloopwherem<nN-1,n,n+1passesthroughtheloop22SQAandTestingBasisPathTesting
(基路徑測試)Basispathtestingisawhite-boxtestingtechnique.Basispathtestingidentifiestestcasesbasedontheflowsorlogicalpathsthatcanbetakenthroughaprogram.Abasispathisauniquepaththroughtheprogramwherenoiterationsareallowed.Basispathtestingusuallyisappliedtointegrationtestingwhenprogrammodulesareintegratedtogether.SoftwareTestingTechniques23SQAandTestingDD-PathgraphTestCaseBasisPathTestingCase1.FirstABCGlastCase2.FirstABEFGlastCase3.FirstABCBCGlastCase4.FirstABCBEFGlastCase5.FirstADEFGLastCase6.FirstADFGlastADBEGCFfirstlast24SQAandTestingEDCfirstBIHGFMLKJNOlastADD-PathgraphforthetriangleprogramTestCaseDD-PathTestingCase1.FirstABDEFGOlastCase2.FirstABCEFHINOla
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 雙方土地買賣合同范本
- 個人年會發(fā)言稿簡短
- 危機公關(guān)服務(wù)合同范本
- 個人向公司借款合同
- 二結(jié)構(gòu)瓦工合同范本
- 儀表自動化模擬練習(xí)題含答案
- 醫(yī)藥研發(fā)調(diào)研合同范本
- 保健按摩測試題含參考答案
- 廚房小店出租合同范例
- 廠房帶貨梯合同范本
- 《過華清宮絕句(其一)》-【中職專用】高一語文(高教版2023基礎(chǔ)模塊下冊)
- 人工智能對日常生活的影響
- (應(yīng)用詳盡版)純?nèi)斯趧?wù)分包簡單的合同(通用)
- 《汽車油料與維護》課件
- 《有限元基礎(chǔ)》課件
- 2024年中國鐵路南寧局集團招聘筆試參考題庫含答案解析
- 《3D打印技術(shù)》課程標(biāo)準(zhǔn)2
- 第三章稻谷碾米
- 中小學(xué)教師評課評價量表
- 胸痛中心培訓(xùn)課件胸痛中心救治流程
- 紙與我們的生活
評論
0/150
提交評論