版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
White-BoxTestingTechniquesIIPreparedbyStephenM.Thebaut,Ph.D.UniversityofFloridaSoftwareTestingandVerificationLecture8White-BoxTestingTechniquesIWhite-BoxTestingTopicsLogiccoverage(lectureI)Dataflowcoverage(lectureII)Pathconditionsandsymbolicevaluation(lectureIII)Otherwhite-boxtestingstrategies(e.g.,“fault-basedtesting”)(lectureIV)White-BoxTestingTopicsLogicDataflowCoverageBasedontheideathatprogrampathsalongwhichvariablesaredefinedandthenusedshouldbecovered.Afamilyofpathselectioncriteriahasbeendefined,eachprovidingadifferentdegreeofcoverage.CASEtoolsupportisverydesirable.DataflowCoverageBasedontheVariableDefinitionsandUsesAprogramvariableisDEFINEDwhenitappears:onthelefthandsideofanassignmentstatement(e.g.,
Y:=17)inaninputstatement(e.g.,input(Y))asanOUTparameterinasubroutinecall(e.g.,
DOIT(X:IN,Y:OUT))VariableDefinitionsandUsesAVariableDefinitionsandUses(cont’d)AprogramvariableisUSEDwhenitappears:ontherighthandsideofanassignmentstatement(e.g.,Y:=X+17)asanINparameterinasubroutineorfunctioncall(e.g.,Y:=SQRT(X))inthepredicateofabranchstatement(e.g.,if
X>0then...)VariableDefinitionsandUsesVariableDefinitionsandUses(cont’d)Useofavariableinthepredicateofabranchstatementiscalledapredicate-use(“p-use”).Anyotheruseiscalledacomputation-use(“c-use”).Forexample,intheprogramstatement:
If(X>0)then print(Y)
end_if_then thereisap-useofXandac-useofY.VariableDefinitionsandUsesVariableDefinitionsandUses(cont’d)Avariablecanalsobeusedandthenre-definedinasinglestatementwhenitappears:onbothsidesofanassignmentstatement(e.g.,
Y:=Y+X)asanIN/OUTparameterinasubroutinecall(e.g.,INCREMENT(Y:IN/OUT))VariableDefinitionsandUsesOtherDataflowTermsand(Informal)DefinitionsApathisdefinitionclear
(“def-clear”)withrespecttoavariablevifthereisnore-definitionofvwithinthepath.Acompletepath
isapathwhoseinitialnodeisa/thestartnodeandwhosefinalnodeisa/theexitnode.OtherDataflowTermsand(InfoOtherDataflowTermsand(Informal)Definitions(cont’d)Adefinition-usepair
(“du-pair”)withrespecttoavariablevisadouble(d,u)suchthatdisanodeintheprogram’sflowgraphatwhichvisdefined,uisanodeoredgeatwhichvisused,andthereisadef-clearpathwithrespecttovfromdtou.(Notethatthedefinitionofadu-pairdoesnotrequiretheexistenceofafeasible
def-clearpathfromdtou.)OtherDataflowTermsand(InfoExample11.input(A,B)
if(B>1)then2.A:=A+7
end_if3.if(A>10)then4.B:=A+B
end_if5.output(A,B)12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)Example11.input(A,B)12345inpIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableBdu-pairpath(s)(1,4)<1,2,3,4><1,3,4>(1,5)<1,2,3,5>
<1,3,5>(1,<1,2>)<1,2>(1,<1,3>)<1,3>(4,5)<4,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)IdentifyingDU-Pairs–VariablDataflowTestCoverageCriteriaAll-Defs:foreveryprogramvariablev,atleastone
def-clearpathfromeverydefinitionofvtoatleastonec-useoronep-useofvmustbecovered.DataflowTestCoverageCriteriDataflowTestCoverageCriteria(cont’d)Consideratestcaseexecutingpath:
1.<1,2,3,4,5>Identifyalldef-clearpathscovered(i.e.,subsumed)bythispathforeachvariable.Arealldefinitionsforeachvariableassociatedwithatleastoneofthesubsumeddef-clearpaths?DataflowTestCoverageCriteriDef-ClearPathsSubsumedby<1,2,3,4,5>forVariableAdu-pairpath(s)(1,2)
<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)
<2,3,4>(2,5)
<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)Def-ClearPathsSubsumedby<1Def-ClearPathsSubsumedby<1,2,3,4,5>forVariableBdu-pairpath(s)(1,4)
<1,2,3,4><1,3,4>(1,5)<1,2,3,5>
<1,3,5>(4,5)
<4,5>(1,<1,2>)<1,2>(1,<1,3>)
<1,3>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)Def-ClearPathsSubsumedby<1DataflowTestCoverageCriteria(cont’d)Since
<1,2,3,4,5>
coversatleastonedef-clearpathfromeverydefinitionofA/Btoatleastonec-useorp-useofA/B,All-Defscoverageisachieved.DataflowTestCoverageCriteriDataflowTestCoverageCriteria(cont’d)All-Uses:foreveryprogramvariablev,
atleastone
def-clearpathfromevery
definitionofvtoevery
c-useandeveryp-useofvmustbecovered.Consideradditionaltestcasesexecutingpaths: 2.<1,3,4,5> 3.<1,2,3,5>DoallthreetestcasesprovideAll-Usescoverage?DataflowTestCoverageCriteriDef-ClearPathsSubsumedby<1,3,4,5>forVariableAdu-pairpath(s)(1,2)<1,2>(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)Def-ClearPathsSubsumedby<1Def-ClearPathsSubsumedby<1,3,4,5>forVariableBdu-pairpath(s)(1,4)
<1,2,3,4><1,3,4>(1,5)<1,2,3,5>
<1,3,5>(4,5)<4,5>(1,<1,2>)<1,2>(1,<1,3>)<1,3>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)Def-ClearPathsSubsumedby<1Def-ClearPathsSubsumedby<1,2,3,5>forVariableAdu-pairpath(s)(1,2)<1,2>
(1,4)<1,3,4>(1,5)<1,3,4,5>
<1,3,5>(1,<3,4>)<1,3,4>(1,<3,5>)<1,3,5>(2,4)<2,3,4>(2,5)<2,3,4,5>
<2,3,5>(2,<3,4>)<2,3,4>(2,<3,5>)<2,3,5>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)Def-ClearPathsSubsumedby<1Def-ClearPathsSubsumedby<1,2,3,5>forVariableBdu-pairpath(s)(1,4)
<1,2,3,4><1,3,4>(1,5)
<1,2,3,5>
<1,3,5>(4,5)<4,5>(1,<1,2>)<1,2>
(1,<1,3>)<1,3>12345input(A,B)A:=A+7B:=A+BB>1B1A>10A10output(A,B)Def-ClearPathsSubsumedby<1DataflowTestCoverageCriteria(cont’d)Sincenoneofthethreetestcasescoversthedu-pair(1,<3,5>)forvariableA,All-UsesCoverageisnotprovided.DataflowTestCoverageCriteriWhatwouldbeevenstrongerthanAll-Uses?WehaveconsideredtheAll-DefsandtheAll-Usescriteriasofar.HowcouldthedefinitionofAll-Usesbemodifiedtomakeitevenstronger?Recall:
All-Uses:foreveryprogramvariablev,atleastone
def-clearpathfromeverydefinitionofvtoeveryc-useandeveryp-useofvmustbecovered.WhatwouldbeevenstrongerthExample21.input(X,Y)2.while(Y>0)do3.if(X>0)then4.Y:=Y-X
else5.input(X)
end_if_then_else6.end_while7.output(X,Y)13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0Example21.input(X,Y)13input(IdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)
<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)
<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)
<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)
<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(1,4)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,7)<1,2,7>
<1,2,3,4,6,7><1,2,3,4,6,(3,4,6)*,7>(1,<3,4>)<1,2,3,4><1,2,3,4,(6,3,4)*>(1,<3,5>)<1,2,3,5>(5,4)<5,6,3,4><5,6,3,4,(6,3,4)*>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7><5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?
infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5><5,6,3,4,6,(3,4,6)*,3,5>?infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5>?<5,6,3,4,6,(3,4,6)*,3,5>?
infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablIdentifyingDU-Pairs–VariableXdu-pairpath(s)(5,7)<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*7>(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5>?<5,6,3,4,6,(3,4,6)*,3,5>
??
infeasible13input(X,Y))Y:=Y-Xinput(X)Y>0Y0X>0output(X,Y)X024567Y>0Y0IdentifyingDU-Pairs–VariablMoreDataflowTermsandDefinitionsApath(eitherpartialorcomplete)issimple
ifalledgeswithinthepatharedistinct(i.e.,different).Apathisloop-free
ifallnodeswithinthepatharedistinct(i.e.,different).MoreDataflowTermsandDefiniSimpleandLoop-FreePathspathSimple?Loop-free?<1,3,4,2><1,2,3,2><1,2,3,1,2><1,2,3,2,4>SimpleandLoop-FreePathspathSimpleandLoop-FreePaths(cont’d)
Whichisstronger,simpleorloop-free?SimpleandLoop-FreePaths(coMoreDataflowTermsandDefinitions
Apath<n1,n2,...,nj,nk>isadu-path
withrespecttoavariablevifvisdefinedatnoden1andeither:thereisac-useofvatnodenkand<n1,n2,...,nj,nk>isadef-clearsimple
path,orthereisap-useofvatedge<nj,nk>and<n1,n2,...nj>isadef-clearloop-free
path.MoreDataflowTermsandDefiniMoreDataflowTermsandDefinitions
Apath<n1,n2,...,nj,nk>isadu-path
withrespecttoavariablevifvisdefinedatnoden1andeither:thereisac-useofvatnodenkand<n1,n2,...,nj,nk>isadef-clearsimple
path,orthereisap-useofvatedge<nj,nk>and<n1,n2,...nj>isadef-clearloop-free
path.NOTE!MoreDataflowTermsandDefiniIdentifyingdu-pathsdu-pairpath(s)du-path?X:(5,7)
<5,6,7>?<5,6,3,4,6,7><5,6,3,4,6,(3,4,6)*,7>X:(5,<3,4>)<5,6,3,4><5,6,3,4,(6,3,4)*>X:(5,<3,5>)<5,6,3,5><5,6,3,4,6,3,5>?<5,6,3,4,6,(3,4,6)*,3,5>??infeasibleIdentifyingdu-pathsdu-pairpatAnotherDataflowTestCoverageCriterionAll-DU-Paths:
foreveryprogramvariablev,
everydu-pathfromeverydefinitionofvtoeveryc-useandeveryp-useofvmustbecovered.AnotherDataflowTestCoverageExerciseIdentifyallc-usesandp-usesforvariableYinExample2.Foreachc-useorp-use,identify(usingthe“*”notation)alldef-clearpaths.Identifywhetherornoteachdef-clearpathisfeasible,andwhetherornotitisadu-path.ExerciseIdentifyallc-usesanSummaryofWhite-BoxCoverageRelationshipsPathAlldu-pathsAll-UsesAll-DefsCompoundConditionBranch/ConditionBasisPathsLoopConditionStatementBranch**-nominalcases*SummaryofWhite-BoxCoverageWhite-BoxTestingTechniquesIIPreparedbyStephenM.Thebaut,Ph.D.UniversityofFloridaSoftwareTestingandVerificationLecture8White-BoxTestingTechniquesIWhite-BoxTestingTechniquesIIPreparedbyStephenM.Thebaut,Ph.D.UniversityofFloridaSoftwareTestingandVerificationLecture8White-BoxTestingTechniquesIWhite-BoxTestingTopicsLogiccoverage(lectureI)Dataflowcoverage(lectureII)Pathconditionsandsymbolicevaluation(lectureIII)Otherwhite-boxtestingstrategies(e.g.,“fault-basedtesting”)(lectureIV)White-BoxTestingTopicsLogicDataflowCoverageBasedontheideathatprogrampathsalongwhichvariablesaredefinedandthenusedshouldbecovered.Afamilyofpathselectioncriteriahasbeendefined,eachprovidingadifferentdegreeofcoverage.CASEtoolsupportisverydesirable.DataflowCoverageBasedontheVariableDefinitionsandUsesAprogramvariableisDEFINEDwhenitappears:onthelefthandsideofanassignmentstatement(e.g.,
Y:=17)inaninputstatement(e.g.,input(Y))asanOUTparameterinasubroutinecall(e.g.,
DOIT(X:IN,Y:OUT))VariableDefinitionsandUsesAVariableDefinitionsandUses(cont’d)AprogramvariableisUSEDwhenitappears:ontherighthandsideofanassignmentstatement(e.g.,Y:=X+17)asanINparameterinasubroutineorfunctioncall(e.g.,Y:=SQRT(X))inthepredicateofabranchstatement(e.g.,if
X>0then...)VariableDefinitionsandUsesVariableDefinitionsandUses(cont’d)Useofavariableinthepredicateofabranchstatementiscalledapredicate-use(“p-use”).Anyotheruseiscalledacomputation-use(“c-use”).Forexample,intheprogramstatement:
If(X>0)then print(Y)
end_if_then thereisap-useofXandac-useofY.VariableDefinitionsandUsesVariableDefinitionsandUses(cont’d)Avariablecanalsobeusedandthenre-definedinasinglestatementwhenitappears:onbothsidesofanassignmentstatement(e.g.,
Y:=Y+X)asanIN/OUTparameterinasubroutinecall(e.g.,INCREMENT(Y:IN/OUT))VariableDefinitionsandUsesOthe
溫馨提示
- 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)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026江蘇連云港市灌云萬邦人力資源有限公司招聘10人考試備考試題及答案解析
- 2025年港大中國語言文學筆試及答案
- 2025年臨沂下半年事業(yè)編考試及答案
- 2025年撫州國企招聘筆試及答案
- 2025年秘書職業(yè)技能大賽筆試題及答案
- 2025年沈陽工程輔導(dǎo)員筆試及答案
- 2025年杭商傳媒記者崗筆試及答案
- 2025年百度財務(wù)助理筆試及答案
- 湖北省省屬國企外包員工招聘3人筆試備考試題及答案解析
- 2025年農(nóng)職院中職筆試真題及答案
- web開發(fā)面試題及答案
- 2026年河南農(nóng)業(yè)職業(yè)學院高職單招職業(yè)適應(yīng)性考試參考題庫含答案解析
- 2026年揚州工業(yè)職業(yè)技術(shù)學院高職單招職業(yè)適應(yīng)性測試參考題庫含答案解析
- 2026年銅陵安徽耀安控股集團有限公司公開招聘工作人員2名考試備考題庫及答案解析
- 安全帽使用規(guī)范制度
- 2025年醫(yī)療器械注冊代理協(xié)議
- 廣西壯族自治區(qū)職教高考英語學科聯(lián)考卷(12月份)和參考答案解析
- 2026年《必背60題》腫瘤內(nèi)科醫(yī)師高頻面試題包含答案
- 電荷轉(zhuǎn)移動力學模擬-洞察及研究
- 2024–2025學年度第一學期期末卷 八年級歷史(試題)
- 藥店質(zhì)量管理制度執(zhí)行情況檢查考核記錄表
評論
0/150
提交評論