Chapter 3 The Realities of Software Testing.docx

上传人:b****5 文档编号:6694896 上传时间:2023-01-09 格式:DOCX 页数:17 大小:176.70KB
下载 相关 举报
Chapter 3 The Realities of Software Testing.docx_第1页
第1页 / 共17页
Chapter 3 The Realities of Software Testing.docx_第2页
第2页 / 共17页
Chapter 3 The Realities of Software Testing.docx_第3页
第3页 / 共17页
Chapter 3 The Realities of Software Testing.docx_第4页
第4页 / 共17页
Chapter 3 The Realities of Software Testing.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

Chapter 3 The Realities of Software Testing.docx

《Chapter 3 The Realities of Software Testing.docx》由会员分享,可在线阅读,更多相关《Chapter 3 The Realities of Software Testing.docx(17页珍藏版)》请在冰豆网上搜索。

Chapter 3 The Realities of Software Testing.docx

Chapter3TheRealitiesofSoftwareTesting

Chapter3.TheRealitiesofSoftwareTesting

INTHISCHAPTER

∙TestingAxioms

∙SoftwareTestingTermsandDefinitions

InChapter1,"SoftwareTestingBackground,"andChapter2,"TheSoftwareDevelopmentProcess,"youlearnedaboutthebasicsofsoftwaretestingandthesoftwaredevelopmentprocess.Theinformationpresentedinthesechaptersofferedaveryhigh-levelandarguablyidealisticviewofhowsoftwareprojectsmightberun.Unfortunately,intherealworldyouwillneverseeaprojectperfectlyfollowanyofthedevelopmentmodels.Youwillneverbegivenathoroughlydetailedspecificationthatperfectlymeetsthecustomer'sneedsandyouwillneverhaveenoughtimetodoallthetestingyouneedtodo.Itjustdoesn'thappen.But,tobeaneffectivesoftwaretester,youneedtounderstandwhattheidealprocessissothatyouhavesomethingtoaimfor.

Thegoalofthischapteristotemperthatidealismwitharealitycheckfromasoftwaretester'sperspective.Itwillhelpyouseethat,inpractice,trade-offsandconcessionsmustbemadethroughoutthedevelopmentcycle.Manyofthosetrade-offsaredirectlyrelatedtothesoftwaretesteffort.Thebugsyoufindandtheproblemsyoupreventallsignificantlyaffecttheproject.Afterreadingthischapter,you'llhaveamuchclearerpictureoftheroles,theimpact,andtheresponsibilitiesthatsoftwaretestinghasandyou'llhopefullyappreciatethebehind-the-scenesdecisionsthatmustbemadetocreateasoftwareproduct.

Thehighlightsofthischapterinclude

∙Whysoftwarecanneverbeperfect

∙Whysoftwaretestingisn'tjustatechnicalproblem

∙Thetermscommonlyusedbysoftwaretesters

TestingAxioms

Thisfirstsectionofthischapterisalistofaxioms,ortruisms.Thinkofthemasthe"rulesoftheroad"orthe"factsoflife"forsoftwaretestingandsoftwaredevelopment.Eachofthemisalittletidbitofknowledgethathelpsputsomeaspectoftheoverallprocessintoperspective.

It'sImpossibletoTestaProgramCompletely

Asanewtester,youmightbelievethatyoucanapproachapieceofsoftware,fullytestit,findallthebugs,andassurethatthesoftwareisperfect.Unfortunately,thisisn'tpossible,evenwiththesimplestprograms,duetofourkeyreasons:

∙Thenumberofpossibleinputsisverylarge.

∙Thenumberofpossibleoutputsisverylarge.

∙Thenumberofpathsthroughthesoftwareisverylarge.

∙Thesoftwarespecificationissubjective.Youmightsaythatabugisintheeyeofthebeholder.

Multiplyallthese"verylarge"possibilitiestogetherandyougetasetoftestconditionsthat'stoolargetoattempt.Ifyoudon'tbelieveit,considertheexampleshowninFigure3.1,theMicrosoftWindowsCalculator.

Figure3.1.EvenasimpleprogramsuchastheWindowsCalculatoristoocomplextocompletelytest.

AssumethatyouareassignedtotesttheWindowsCalculator.Youdecidetostartwithaddition.Youtry1+0=.Yougetananswerof1.That'scorrect.Thenyoutry1+1=.Youget2.Howfardoyougo?

Thecalculatoracceptsa32-digitnumber,soyoumusttryallthepossibilitiesupto

1+99999999999999999999999999999999=

Onceyoucompletethatseries,youcanmoveonto2+0=,2+1=,2+2=,andsoon.Eventuallyyou'llgetto

99999999999999999999999999999999+99999999999999999999999999999999=

Nextyoushouldtryallthedecimalvalues:

1.0+0.1,1.0+0.2,andsoon.

Onceyouverifythatregularnumberssumproperly,youneedtoattemptillegalinputstoassurethatthey'reproperlyhandled.Remember,you'renotlimitedtoclickingthenumbersonscreenyoucanpresskeysonyourcomputerkeyboard,too.Goodvaluestotrymightbe1+a,z+1,1a1+2b2,….Thereareliterallybillionsuponbillionsofthese.

Editedinputsmustalsobetested.TheWindowsCalculatorallowstheBackspaceandDeletekeys,soyoushouldtrythem.12+2shouldequal4.Everythingyou'vetestedsofarmustberetestedbypressingtheBackspacekeyforeachentry,foreachtwoentries,andsoon.

Ifyouoryourheirsmanagetocompleteallthesecases,youcanthenmoveontoaddingthreenumbers,thenfournumbers,….

Therearesomanypossibleentriesthatyoucouldnevercompletethem,evenifyouusedasupercomputertofeedinthenumbers.Andthat'sonlyforaddition.Youstillhavesubtraction,multiplication,division,squareroot,percentage,andinversetocover.

Thepointofthisexampleistodemonstratethatit'simpossibletocompletelytestaprogram,evensoftwareassimpleasacalculator.Ifyoudecidetoeliminateanyofthetestconditionsbecauseyoufeelthey'reredundantorunnecessary,orjusttosavetime,you'vedecidednottotesttheprogramcompletely.

SoftwareTestingIsaRisk-BasedExercise

Ifyoudecidenottotesteverypossibletestscenario,you'vechosentotakeonrisk.Inthecalculatorexample,whatifyouchoosenottotestthat1024+1024=2048?

It'spossibletheprogrammeraccidentallyleftinabugforthatsituation.Ifyoudon'ttestit,acustomerwilleventuallyenterit,andheorshewilldiscoverthebug.It'llbeacostlybug,too,sinceitwasn'tfounduntilthesoftwarewasinthecustomer'shands.

Thismayallsoundprettyscary.Youcan'ttesteverything,andifyoudon't,youwilllikelymissbugs.Theproducthastobereleased,soyouwillneedtostoptesting,butifyoustoptoosoon,therewillstillbeareasuntested.Whatdoyoudo?

Onekeyconceptthatsoftwaretestersneedtolearnishowtoreducethehugedomainofpossibletestsintoamanageableset,andhowtomakewiserisk-baseddecisionsonwhat'simportanttotestandwhat'snot.

Figure3.2showstherelationshipbetweentheamountoftestingperformedandthenumberofbugsfound.Ifyouattempttotesteverything,thecostsgoupdramaticallyandthenumberofmissedbugsdeclinestothepointthatit'snolongercosteffectivetocontinue.Ifyoucutthetestingshortormakepoordecisionsofwhattotest,thecostsarelowbutyou'llmissalotofbugs.Thegoalistohitthatoptimalamountoftestingsothatyoudon'ttesttoomuchortoolittle.

Figure3.2.Everysoftwareprojecthasanoptimaltesteffort.

YouwilllearnhowtodesignandselecttestscenariosthatminimizeriskandoptimizeyourtestinginChapters4through7.

TestingCan'tShowThatBugsDon'tExist

Thinkaboutthisforamoment.You'reanexterminatorchargedwithexaminingahouseforbugs.Youinspectthehouseandfindevidenceofbugsmaybelivebugs,deadbugs,ornests.Youcansafelysaythatthehousehasbugs.

Youvisitanotherhouse.Thistimeyoufindnoevidenceofbugs.Youlookinalltheobviousplacesandseenosignsofaninfestation.Maybeyoufindafewdeadbugsoroldnestsbutyouseenothingthattellsyouthatlivebugsexist.Canyouabsolutely,positivelystatethatthehouseisbugfree?

Nope.Allyoucanconcludeisthatinyoursearchyoudidn'tfindanylivebugs.Unlessyoucompletelydismantledthehousedowntothefoundation,youcan'tbesurethatyoudidn'tsimplyjustmissthem.

Softwaretestingworksexactlyastheexterminatordoes.Itcanshowthatbugsexist,butitcan'tshowthatbugsdon'texist.Youcanperformyourtests,findandreportbugs,butatnopointcanyouguaranteethattherearenolongeranybugstofind.Youcanonlycontinueyourtestingandpossiblyfindmore.

TheMoreBugsYouFind,theMoreBugsThereAre

Thereareevenmoresimilaritiesbetweenrealbugsandsoftwarebugs.Bothtypestendtocomeingroups.Ifyouseeone,oddsaretherewillbemorenearby.

Frequently,atesterwillgoforlongspellswithoutfindingabug.He'llthenfindonebug,thenquicklyanotherandanother.Thereareseveralreasonsforthis:

∙Programmershavebaddays.Likeallofus,programmerscanhaveoffdays.Codewrittenonedaymaybeperfect;codewrittenanothermaybesloppy.Onebugcanbeatell-talesignthattherearemorenearby.

∙Programmersoftenmakethesamemistake.Everyonehashabits.Aprogrammerwhoispronetoacertainerrorwilloftenrepeatit.

∙Somebugsarereallyjustthetipoftheiceberg.Veryoftenthesoftware'sdesignorarchitecturehasafundamentalproblem.Atesterwillfindseveralbugsthatatfirstmayseemunrelatedbuteventuallyarediscoveredtohaveoneprimaryseriouscause.

It'simportanttonotethattheinverseofthis"bugsfollowbugs"ideaistrue,aswell.Ifyoufailtofindbugsnomatterhowhardyoutry,itmayverywellbethatthefeatureyou'retestingwascleanlywrittenandthatthereareindeedfewifanybugstobefound.

ThePesticideParadox

In1990,BorisBeizer,inhisbookSoftwareTestingTechniques,SecondEdition,coinedthetermpesticideparadoxtodescribethephenomenonthatthemoreyoutestsoftware,themoreimmuneitbecomestoyourtests.Thesamethinghappenstoinsectswithpesticides(seeFigure3.3).Ifyoukeepapplyingthesamepesticide,theinsectseventuallybuildupresistanceandthepesticidenolongerworks.

Figure3.3.Softwareundergoingthesamerepetitivetestseventuallybuildsupresistancetothem.

RememberthespiralmodelofsoftwaredevelopmentdescribedinChapter2?

Thetestprocessrepeatseachtimearoundtheloop.Witheachiteration,thesoftwaretestersreceivethesoftwarefortestingandruntheirtests.Eventually,afterseveralpasses,allthebugsthatthosetestswouldfindareexposed.Continuingtorunthemwon'trevealanythingnew.

Toovercomethepesticideparadox,softwaretestersmustcontinuallywritenewanddifferentteststoexercisedifferentpartsoftheprogramandfindmorebugs.

NotAlltheBugsYouFindWillBeFixed

Oneofthesadrealitiesofsoftwaretestingisthatevenafterallyourhardwork,noteverybugyou

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 金融投资

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1