Anda di halaman 1dari 5

Table of Contents

Introduct|on
J|te 8ox 1est|ng
Cond|t|on Coverage
Lxamp|e 4
Advantages S
D|sadvantages S
Conc|us|on S


Page


Introduct|on
CondlLlon coverage reporLs Lhe Lrue or false ouLcome of each condlLlon A condlLlon ls an
operand of a loglcal operaLor LhaL does noL conLaln loglcal operaLors CondlLlon coverage measures Lhe
condlLlons lndependenLly of each oLher CondlLlon coverage comblnes Lhe requlremenLs for declslon
coverage wlLh Lhose for condlLlon coverage 1haL ls Lhere musL be sufflclenL LesL cases Lo Loggle Lhe
declslon ouLcome beLween Lrue and false and Lo Loggle each condlLlon value beLween Lrue and false
Pence a mlnlmum of Lwo LesL cases are necessary for each declslon
uslng Lhe example (A or 8) LesL cases (11) and (ll) would meeL Lhe coverage requlremenL
Powever Lhese Lwo LesLs do noL dlsLlngulsh Lhe correcL expresslon (A or 8) from Lhe expresslon A or
from Lhe expresslon 8 or from Lhe expresslon (A and 8) CondlLlon coverage ls also known as redlcaLe
Coverage CondlLlon coverage ls seen for 8oolean expresslon condlLlon coverage ensures wheLher all
Lhe 8oolean expresslons have been evaluaLed Lo boLh 18uL and lALSL
J|te 8ox 1est|ng
WhlLebox LesLlng (also known as clear box LesLlng glass box LesLlng LransparenL box LesLlng
and sLrucLural LesLlng) ls a meLhod of LesLlng sofLware LhaL LesLs lnLernal sLrucLures or worklngs of an
appllcaLlon as opposed Lo lLs funcLlonallLy (le blackbox LesLlng) ln whlLebox LesLlng an lnLernal
perspecLlve of Lhe sysLem as well as programmlng skllls are requlred and used Lo deslgn LesL cases 1he
LesLer chooses lnpuLs Lo exerclse paLhs Lhrough Lhe code and deLermlne Lhe approprlaLe ouLpuLs 1hls ls
analogous Lo LesLlng nodes ln a clrculL eg lnclrculL LesLlng (lC1)
Whlle whlLebox LesLlng can be applled aL Lhe unlL lnLegraLlon and sysLem levels of Lhe sofLware
LesLlng process lL ls usually done aL Lhe unlL level lL can LesL paLhs wlLhln a unlL paLhs beLween unlLs
durlng lnLegraLlon and beLween subsysLems durlng a sysLem level LesL 1hough Lhls meLhod of LesL
deslgn can uncover many errors or problems lL mlghL noL deLecL unlmplemenLed parLs of Lhe
speclflcaLlon or mlsslng requlremenLs
Cond|t|on Coverage
1he flrsL lmprovemenL Lo whlLe box Lechnlques ls Lo ensure LhaL Lhe 8oolean conLrolllng
expresslons are adequaLely LesLed a process known as condlLlon LesLlng
1he process of condlLlon LesLlng ensures LhaL a conLrolllng expresslon has been adequaLely
exerclsed whllsL Lhe sofLware ls under LesL by consLrucLlng a consLralnL seL for every expresslon and Lhen
ensurlng LhaL every member on Lhe consLralnL seL ls lncluded ln Lhe values whlch are presenLed Lo Lhe
expresslon 1hls may requlre addlLlonal LesL runs Lo be lncluded ln Lhe LesL plan
1o lnLroduce Lhe concepL of consLralnL seLs Lhe slmplesL posslble 8oolean condlLlon a slngle
8oolean varlable or a negaLed 8oolean varlable wlll be consldered 1hese condlLlons may Lake forms
such as

Page


|f DateVa||d ten
w||e not DateVa||d
ten
1he consLralnL seL for boLh of Lhese expresslons ls L f whlch lndlcaLes LhaL Lo adequaLely LesL
Lhese expresslons Lhey should be LesLed Lwlce wlLh uaLevalld havlng Lhe values 1rue and lalse
erhaps Lhe nexL slmplesL 8oolean condlLlon conslsLs of a slmple relaLlonal expresslon of Lhe
form value operaLor value where Lhe operaLor can be one of ls equal Lo ( ) ls noL equal Lo ( / ) ls
greaLer Lhan ( ) ls less Lhan ( ) and ls less Lhan or equal Lo ( whlch lndlcaLes LhaL Lo adequaLely
LesL a relaLlonal expresslon lL musL be LesLed Lhree Llmes wlLh values whlch ensure LhaL Lhe Lwo values
are equal LhaL Lhe flrsL value ls less Lhan Lhe second value and LhaL Lhe flrsL value ls greaLer Lhan Lhe
second value
More complex conLrol expresslons lnvolve Lhe use of Lhe 8oolean operaLors and or and xor
whlch comblne Lhe values of Lwo 8oolean values 1o consLrucL a consLralnL seL for a slmple 8oolean
expresslon of Lhe form 8ooleanvalue operaLor 8ooleanvalue all posslble comblnaLlons of 1rue and lalse
have Lo be consldered 1hls glves Lhe consLralnL seL for Lhe expresslon as L L L f f L f f lf boLh
8ooleanvalues are slmple or negaLed 8oolean varlables Lhen no furLher developmenL of Lhls seL ls
requlred Powever lf one or boLh of Lhe 8ooleanvalues are relaLlonal expresslons Lhen Lhe consLralnL seL
for Lhe relaLlonal expresslon wlll have Lo be comblned wlLh Lhls consLralnL seL 1he comblnaLlon Lakes
Lhe form of noLlng LhaL Lhe equallLy condlLlon ls equlvalenL Lo Lrue and Lhe boLh lnequallLy condlLlons
are equlvalenL Lo false 1hus every Lrue condlLlon ln Lhe condlLlon seL ls replaced wlLh and every
false replaced Lwlce once wlLh and once wlLh
1hus lf only one Lhe lefL hand 8ooleanvalue ls a relaLlonal expresslon Lhe condlLlon seL would be
L f L f
An lncrease ln Lhe complexlLy of Lhe 8oolean expresslon by Lhe addlLlon of more operaLors wlll
lnLroduce lmpllclL or expllclL brackeLlng of Lhe order of evaluaLlon whlch wlll be reflecLed ln Lhe
condlLlon seL and wlll lncrease Lhe number of Lerms ln Lhe seL lor example a 8oolean expresslon of Lhe
followlng forms
8ooleanvalue1 operaLor1 8ooleanvalue2 operaLor3nbsp8ooleanvalue3
Pas Lhe lmpllclL brackeLlng
(8ooleanvalue1 operaLor1 8ooleanvalue2) operaLo3 8ooleanvalue3
1he consLralnL seL for Lhe compleLe expresslon would be e1Le1f where e1 ls Lhe condlLlon
seL of Lhe brackeLed subexpresslon and when lL ls used Lo expand Lhls consLralnL seL glves LLL LfL
fLL ffL LLf Lff fLf fff lf any of Lhe 8ooleanvalues are Lhemselves relaLlonal expresslons
Lhls wlll lncrease Lhe number of Lerms ln Lhe condlLlon seL ln Lhls example Lhe worsL case would be lf all

Page


Lhree values were relaLlonal expresslons and would produce a LoLal of 27 Lerms ln Lhe condlLlon seL 1hls
would lmply LhaL 27 LesLs are requlred Lo adequaLely LesL Lhe expresslon As Lhe number of 8oolean
operaLor's lncreases Lhe number of Lerms ln a condlLlon seL lncreases exponenLlally and comprehenslve
LesLlng of Lhe expresslon becomes more compllcaLed and less llkely lL ls Lhls conslderaLlon whlch led Lo
Lhe advlce lnlLlally glven ln SecLlon 1 Lo keep 8oolean conLrol expresslons as slmple as posslble and
one way Lo do Lhls ls Lo use 8oolean varlables raLher Lhan expresslons wlLhln such conLrol condlLlons
Lxamp|e
Conslder Lhe followlng fragmenL of code
lf A or (8 and C) Lhen
do_someLhlng
else
do_someLhlng_else
end lf
1he 8oolean operands wlLhln Lhe declslon condlLlon are A 8 and C 1hese may Lhemselves be
comprlsed of complex expresslons lnvolvlng relaLlonal operaLors lor example Lhe 8oolean operand A
could be an expresslon such as x? Powever for Lhe sake of clarlLy Lhe followlng examples regard A 8
and C as slmple 8oolean operands 8ranch CondlLlon Coverage would requlre 8oolean operand A Lo be
evaluaLed boLh 18uL and lALSL 8oolean operand 8 Lo be evaluaLed boLh 18uL and lALSL and 8oolean
operand C Lo be evaluaLed boLh 18uL and lALSL
8ranch CondlLlon Coverage may Lherefore be achleved wlLh Lhe followlng seL of LesL lnpuLs
(noLe LhaL Lhere are alLernaLlve seLs of LesL lnpuLs whlch wlll also achleve 8ranch CondlLlon Coverage)
Case A 8 C
1 lALSL lALSL lALSL
2 18uL 18uL 18uL
8ranch CondlLlon Coverage can ofLen be achleved wlLh [usL Lwo LesL cases lrrespecLlve of Lhe
number of acLual 8oolean operands comprlslng Lhe condlLlon A furLher weakness of 8ranch CondlLlon
Coverage ls LhaL lL can ofLen be achleved wlLhouL LesLlng boLh Lhe 18uL and lALSL branches of Lhe
declslon lor example Lhe followlng alLernaLlve seL of LesL lnpuLs achleve 8ranch CondlLlon Coverage
buL only LesL Lhe 18uL ouLcome of Lhe overall 8oolean condlLlon 1hus 8ranch CondlLlon Coverage wlll
noL necessarlly subsume 8ranch Coverage
Case A 8 C
1 18uL lALSL lALSL
2 lALSL 18uL 18uL

Page


8ranch CondlLlon ComblnaLlon Coverage would requlre all comblnaLlons of 8oolean operands A
8 and C Lo be evaluaLed lor Lhe example condlLlon 8ranch CondlLlon ComblnaLlon Coverage can only
be achleved wlLh Lhe followlng seL of LesL lnpuLs
Case A 8 C
1 lALSL lALSL lALSL
2 18uL lALSL lALSL
3 lALSL 18uL lALSL
4 lALSL lALSL 18uL
3 18uL 18uL lALSL
6 lALSL 18uL 18uL
7 18uL lALSL 18uL
8 18uL 18uL 18uL
8ranch CondlLlon ComblnaLlon Coverage ls very Lhorough requlrlng 2
n
LesL cases Lo achleve
100 coverage of a condlLlon conLalnlng n 8oolean operands 1hls rapldly becomes unachlevable for
more complex condlLlons
Advantages
1 lL provldes lnslghL Lo almosL all Lhe elemenLs of Lhe sofLware
2 lL shows Lhe behavlor of Lhe elemenLs lnLeracLlng wlLh each oLher
3 lL shows Lhe problems faclng ln Lhe scenarlos
4 lL glves soluLlon Lo Lhe problems appeared
3 lL also provldes alLernaLlves Lo Lhe soluLlons
6 lL ls very efflclenL Lo bulld LesL cases
D|sadvantages
1 lL ls a lengLhy and Llme consumlng procedure
2 lL can be frusLraLlng where Llme llmlL ls shorL
3 lL ls dlfflculL Lo conducL ln large and complex sofLware
4 lL does noL provlde fuLure predlcLlons for Lhe fuLure condlLlons
3 lL has llmlLed scope
Conc|us|on
AlLhough LesLlng coverage ls a good procedure for bulldlng LesLlng cases Clven lLs dlsadvanLages
lL ls sLlll efflclenL enough Lo glve deslred resulL Powever wlLh careful plannlng lL can be conducLed wlLh
maxlmum ouLpuL WlLh lLs llmlLed scope lL ls very effecLlve for Lhe under developmenL pro[ecLs

Anda mungkin juga menyukai