white數(shù)據(jù)流覆蓋匯總課件_第1頁
white數(shù)據(jù)流覆蓋匯總課件_第2頁
white數(shù)據(jù)流覆蓋匯總課件_第3頁
white數(shù)據(jù)流覆蓋匯總課件_第4頁
white數(shù)據(jù)流覆蓋匯總課件_第5頁
已閱讀5頁,還剩141頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(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. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論