




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(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è)計(jì)構(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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 文化旅游項(xiàng)目策劃書(范文三)
- 無人機(jī)項(xiàng)目工程建設(shè)方案范文
- 擊劍俱樂部營銷方案
- 保險(xiǎn)公司實(shí)習(xí)總結(jié)范文(31篇)
- 保密知識考試題庫帶答案(輕巧奪冠)
- 2025年中國旋轉(zhuǎn)式收納盒行業(yè)市場前景預(yù)測及投資價(jià)值評估分析報(bào)告
- 徐州銅山縣夾河中學(xué)高三英語一輪復(fù)習(xí)導(dǎo)學(xué)案MU四
- 徐州市中小學(xué)教學(xué)研究室高一數(shù)學(xué)蘇教版《余弦定理》預(yù)案
- 2025年運(yùn)載火箭發(fā)動(dòng)機(jī)地面檢測設(shè)備項(xiàng)目規(guī)劃申請報(bào)告
- 2025年中考語文總復(fù)習(xí)2022年全國各地中考129道作文題(打印版)
- 貨運(yùn)物流提前報(bào)備通知函
- 2025年度山西建設(shè)投資集團(tuán)限公司高校畢業(yè)生招聘885人高頻重點(diǎn)提升(共500題)附帶答案詳解
- 2021-2022年北京市大興區(qū)六年級下冊期末數(shù)學(xué)試卷及答案(人教版)
- 高考高中物理知識點(diǎn)考點(diǎn)框架圖導(dǎo)圖
- 胃食管反流病指南
- 《假如我是患者》課件
- 第三單元+法律與教化+復(fù)習(xí)背誦清單 高二上學(xué)期歷史統(tǒng)編版(2019)選擇性必修1國家制度與社會治理
- 施工機(jī)具安全管理
- 中考數(shù)學(xué)函數(shù)一次函數(shù)復(fù)習(xí)課件
- 擔(dān)保合同范本
- 水電解制氫設(shè)備操作與維護(hù)規(guī)程
評論
0/150
提交評論