Tải bản đầy đủ

OReilly perl testing a developers notebook jul 2005 ISBN 0596100922

PerlTesting:ADeveloper'sNotebook
Bychromatic,IanLangworth
...............................................
Publisher:O'Reilly
PubDate:July2005
ISBN:0-596-10092-2
Pages:208

TableofContents|Index|Errata

Isthereanysexiertopicinsoftwaredevelopmentthansoftwaretesting?Thatis,
besidesgameprogramming,3Dgraphics,audio,high-performanceclustering,cool
websites,etcetera?Okay,sosoftwaretestingislowonthelist.Andthat's
unfortunate,becausegoodsoftwaretestingcanincreaseyourproductivity,improve
yourdesigns,raiseyourquality,easeyourmaintenanceburdens,andhelptosatisfy
yourcustomers,coworkers,andmanagers.
Perlhasastronghistoryofautomatedtests.AveryearlyreleaseofPerl1.0includeda
comprehensivetestsuite,andit'sonlyimprovedfromthere.LearninghowPerl'stest
toolsworkandhowtoputthemtogethertosolveallsortsofpreviouslyintractable
problemscanmakeyouabetterprogrammeringeneral.Besides,it'seasytousethe
Perltoolsdescribedtohandleallsortsoftestingproblemsthatyoumayencounter,

eveninotherlanguages.

LikealltitlesinO'Reilly'sDeveloper'sNotebookseries,this"alllab,nolecture"book
skipstheboringproseandfocusesinsteadonaseriesofexercisesthatspeaktoyou
insteadofatyou.

PerlTesting:ADeveloper'sNotebookwillhelpyoudiverightinand:
WritebasicPerltestswitheaseandinterprettheresults


Applyspecialtechniquesandmodulestoimproveyourtests
Bundletestsuitesalongwithprojects
Testdatabasesandtheirdata
Testwebsitesandwebprojects
Usethe"TestAnythingProtocol"whichtestsprojectswritteninlanguagesother
thanPerl
Withtoday'sincreasedworkloadsandshortdevelopmentcycles,unittestsaremore
vitaltobuildingrobust,high-qualitysoftwarethaneverbefore.Oncemastered,these
lessonswillhelpyouensurelow-levelcodecorrectness,reducesoftwaredevelopment
cycletime,andeasemaintenanceburdens.

Youdon'thavetobeadie-hardfreeandopensourcesoftwaredeveloperwholives,
breathes,anddreamsPerltousethisbook.Youjusthavetowanttodoyourjoba
littlebitbetter.


PerlTesting:ADeveloper'sNotebook
Bychromatic,IanLangworth
...............................................
Publisher:O'Reilly
PubDate:July2005
ISBN:0-596-10092-2
Pages:208

TableofContents|Index|Errata



Copyright



TheDeveloper'sNotebookSeries



NotebooksAre...



NotebooksAren't...



Organization



Preface



WhatThisBookCovers



ConventionsUsedinThisBook



UsingCodeExamples



SafariEnabled



CommentsandQuestions




Acknowledgments
Chapter1.BeginningTesting



InstallingTestModules



RunningTests



InterpretingTestResults



WritingYourFirstTest



LoadingModules




ImprovingTestComparisons
Chapter2.WritingTests



SkippingTests



SkippingAllTests



MarkingTestsasTODO



SimpleDataStructureEquality



DataComposition



TestingWarnings





TestingExceptions
Chapter3.ManagingTests
OrganizingTests




CheckingYourCoverage



WritingaTestingLibrary



TestingaTestingLibrary



WritingaTestingHarness



TestingAcrosstheNetwork



AutomatingTestRuns



Chapter4.DistributingYourTests(andCode)



TestingPODFiles



TestingDocumentationCoverage



DistributionSignatures



TestingEntireDistributions



LettingtheUserDecide



LettingtheUserDecide(Continued)



BundlingTestswithModules



CollectingTestResults



ValidatingKwalitee



Chapter5.TestingUntestableCode



OverridingBuilt-ins



MockingModules



MockingObjects



PartiallyMockingObjects



OverridingLiveCode




OverridingOperatorsEverywhere
Chapter6.TestingDatabases



ShippingTestDatabases



TestingDatabaseData



UsingTemporaryDatabases




MockingDatabases
Chapter7.TestingWebSites



TestingYourBackend



TestingYourFrontend



RecordandPlayBackBrowsingSessions



TestingtheValidityofHTML



RunningYourOwnApacheServer



TestingwithApache-Test



DistributingModuleswithApache-Test



Chapter8.UnitTestingwithTest::Class



WritingTestCases



CreatingTestFixtures



InheritingTests



SkippingTestswithTest::Class



MarkingTestsasTODOwithTest::Class



Chapter9.TestingEverythingElse



WritingTestablePrograms



TestingPrograms




TestingInteractivePrograms



TestingSharedLibraries






Colophon
AbouttheAuthors
Colophon
Index


PerlTesting:ADeveloper'sNotebook™
byIanLangworthandchromatic
Copyright©2005O'ReillyMedia,Inc.Allrightsreserved.
PrintedintheUnitedStatesofAmerica.
PublishedbyO'ReillyMedia,Inc.,1005GravensteinHighwayNorth,
Sebastopol,CA95472.
O'Reillybooksmaybepurchasedforeducational,business,orsalespromotional
use.Onlineeditionsarealsoavailableformosttitles(safari.oreilly.com).For
moreinformation,contactourcorporate/institutionalsalesdepartment:(800)
998-9938orcorporate@oreilly.com.
Editors:

AllisonRandal



TatianaApandi

ProductionEditor:

AdamWitwer

CoverDesigner:

EdieFreedman

InteriorDesigner:

DavidFutato

July2005:

FirstEdition.

NutshellHandbook,theNutshellHandbooklogo,andtheO'Reillylogoare
registeredtrademarksofO'ReillyMedia,Inc.TheDeveloper'sNotebookseries
designations,PerlTesting:ADeveloper'sNotebook,thelookofalaboratory


notebook,andrelatedtradedressaretrademarksofO'ReillyMedia,Inc.
Manyofthedesignationsusedbymanufacturersandsellerstodistinguishtheir
productsareclaimedastrademarks.Wherethosedesignationsappearinthis
book,andO'ReillyMedia,Inc.wasawareofatrademarkclaim,thedesignations
havebeenprintedincapsorinitialcaps.
Whileeveryprecautionhasbeentakeninthepreparationofthisbook,the
publisherandauthorsassumenoresponsibilityforerrorsoromissions,orfor
damagesresultingfromtheuseoftheinformationcontainedherein.
ISBN:0-596-10092-2
[M]


TheDeveloper'sNotebookSeries
So,you'vemanagedtopickthisbookup.Cool.Really,I'mexcitedaboutthat!Of
course,youmaybewonderingwhythesebookshavetheodd-looking,college
notebooksortofcover.Imean,thisisO'Reilly,right?Wherearetheanimals?
And,really,doyouneedanotherseries?Couldn'tthisjustbeacookbook?How
aboutanutshell,oroneofthosecoolhacksbooksthatseemtobeeverywhere?
Theshortansweristhatadeveloper'snotebookisnoneofthosethingsinfact,it's
suchanimportantideathatwecameupwithanentirelynewlookandfeel,
completewithcover,fonts,andevensomenotesinthemargin.Thisisalla
resultoftryingtogetsomethingintoyourhandsyoucanactuallyuse.
It'smystrongbeliefthatwhiletheninetieswerecharacterizedbyeveryone
wantingtolearneverything(Whynot?Weallhadsix-figureincomesfromdotcomcompanies),thenewmillenniumisaboutinformationpain.Peopledon't
havetime(ortheincome)toreadthrough600-pagebooks,oftenlearning200
things,ofwhichonlyabout4applytotheircurrentjob.Itwouldbemuchnicer
tojustsitnearoneoftheuber-codersandlookoverhisshoulder,wouldn'tit?To
asktheguysthatareneck-deepinthisstuffwhytheychoseaparticularmethod,
howtheyperformedthisonetrickytask,orhowtheyavoidedthatthreading
issuewhenworkingwithpipedstreams.Thethinkinghasalwaysbeenthat
bookscan'tservethatparticularneedtheycaninform,andletyoudecide,but
ultimatelyacoder'smindwassomethingthatcouldn'treallybecapturedona
pieceofpaper.
Thisseriessaysthatassumptionispatentlywrongandweaimtoproveit.
ADeveloper'sNotebookisjustwhatitclaimstobe:theoften-franticscribbling
andnotesthatatrue-bluealphageekmentallymakeswhenworkingwithanew
language,API,orproject.It'stheno-nonsensecodethatsolvesproblems,
strippedofpage-fillingcommentarythatoftenservesmoreasapaperweight
thananepiphany.It'shackery,focusednotonwhatisniftyormightbefuntodo
whenyou'vegotsomefreetime(when'sthelasttimethathappened?),buton
whatyouneedtosimply"makeitwork."Thisisn'talecture,folksit'salab.If
youwantalotofconcept,architecture,andUMLdiagrams,I'llhappilyand
proudlypointyoutoouranimalandnutshellbooks.Ifyouwanteveryanswerto


everyproblemunderthesun,ouromnibuscookbooksarekiller.Andifyouare
intoarcaneandoftenquirkyusesoftechnology,hacksbookssimplyrock.Butif
you'reacoder,downtoyourcore,andyoujustwanttogetonwithit,thenyou
wantaDeveloper'sNotebook.Coffeestainsandall,thisisfromthemindofa
developertoyours,barelyevencleanedupenoughforprint.Ihopeyouenjoy
it...wesurehadagoodtimewritingthem.


NotebooksAre...

Example-drivenguides
Asyou'llseeinthe"Organization"section,developer'snotebooksarebuilt
entirelyaroundexamplecode.You'llseecodeonnearlyeverypage,andit's
codethatdoessomethingnottrivial"HelloWorld!"programsthataren't
worthmorethanthepaperthey'reprintedon.

Aimedatdevelopers
Everreadabookthatseemstobeaimedatpointy-hairedbosses,filledwith
buzzwords,andfeelsmorelikeamarketingmanifestothanaprogramming
text?Wehavetooandthesebooksaretheantithesisofthat.Infact,agood
notebookisincomprehensibletosomeonewhocan'tprogram(don'tsaywe
didn'twarnyou!),andthat'sjustthewayit'ssupposedtobe.Butfor
developers...it'sasgoodasitgets.

Actuallyenjoyabletoworkthrough
Doyoureallyhavetimetositaroundreadingsomethingthatisn'tanyfun?
Ifyoudo,thenmaybeyou'reintothousand-pagelanguagereferencesbutif
you'reliketherestofus,notebooksareamuchbetterfit.Practicalcode
samples,tersedialoguecenteredaroundpracticalexamples,andevensome
humorhereandtherethesearetheingredientsofagooddeveloper's
notebook.

Aboutdoing,nottalkingaboutdoing


Ifyouwanttoreadabooklateatnightwithoutacomputernearby,these
booksmightnotbethatuseful.Theintentisthatyou'recodingasyougo
along,kneedeepinbytecode.Forthatreason,notebookstalkcode,code,
code.Fireupyoureditorbeforediggingin.


NotebooksAren't...

Lectures
Wedon'tletjustanyonewriteadeveloper'snotebookyou'vegottobea
bonafideprogrammer,andpreferablyonewhostaysupalittletoolate
coding.Whilefull-timewriters,academics,andtheoristsaregreatinsome
areas,thesebooksareaboutprogramminginthetrenches,andarefilled
withinstruction,notlecture.

Filledwithconceptualdrawingsandclasshierarchies
Thisisn'tanutshell(there,wesaidit).Youwon'tfind100-pageindiceswith
everymethodlisted,andyouwon'tseefull-pageUMLdiagramswith
methods,inheritancetrees,andflowcharts.Whatyouwillfindispageafter
pageofsourcecode.Areyoustartingtosensearecurringtheme?

Longonexplanation,lightonapplication
Itseemsthatmanyprogrammingbooksthesedayshavethree,four,ormore
chaptersbeforeyouevenseeanyworkingcode.I'mnotsurewhohas
authorsconvincedthatit'sgoodtokeepareaderwaitingthislong,butit's
notanybodyworkingonthisseries.Webelievethatifyou'renotcoding
within10pages,something'swrong.Thesebooksarealsochock-fullof
practicalapplication,takingyoufromanexampleinabooktoputting
thingstoworkonyourjob,asquicklyaspossible.


Organization
Developer'sNotebookstrytocommunicatedifferentinformationthanmost
books,andasaresult,areorganizeddifferently.Theydoindeedhavechapters,
butthat'saboutasfarasthesimilaritybetweenanotebookandatraditional
programmingbookgoes.First,you'llfindthatalltheheadingsineachchapter
areorganizedaroundaspecifictask.You'llnotethatwesaidtask,notconcept.
That'soneoftheimportantthingstogetaboutthesebookstheyarefirstand
foremostaboutdoingsomething.Eachoftheseheadingsrepresentsasinglelab.
Alabisjustwhatitsoundslikestepstoaccomplishaspecificgoal.Infact,that's
thefirstheadingyou'llseeundereachlab:"HowdoIdothat?"Thisisthe
centralquestionofeachlab,andyou'llfindlotsofdown-and-dirtycodeand
detailinthesesections.
Somelabshavesomethingsnottodo(everplayedaroundwithpotassiumin
highschoolchemistry?),helpingyouavoidcommonpitfalls.Somelabsgiveyou
agoodreasonforcaringaboutthetopicinthefirstplace;wecallthisthe"Why
doIcare?"section,forobviousreasons.Forthosetimeswhencodesamples
don'tclearlycommunicatewhat'sgoingon,you'llfinda"Whatjusthappened"
section.It'sinthesesectionsthatyou'llfindconceptsandtheorybuteventhen,
theyaretightlyfocusedonthetaskathand,notexplanationforthesakeofpage
count.Finally,manylabsofferalternatives,andaddresscommonquestions
aboutdifferentapproachestosimilarproblems.Thesearethe"Whatabout..."
sections,whichwillhelpgiveeachtasksomecontextwithintheprogramming
bigpicture.
Andonelastthingonmanypages,you'llfindnotesscrawledinthemarginsof
thepage.Thesearen'tfordecoration;theycontaintips,tricks,insightsfromthe
developersofaproduct,andsometimesevenalittlehumor,justtokeepyou
going.Thesenotesrepresentpartoftheoverallcommunicationflowgettingyou
asclosetoreadingthemindofthedeveloper-authoraswecan.Hopefullythey'll
getyouthatmuchclosertofeelinglikeyouareindeedlearningfromamaster.
Andmostofall,rememberthesebooksare...
AllLab,NoLecture


BrettMcLaughlin,SeriesCreator


Preface
Isthereanysexiertopicinsoftwaredevelopmentthansoftwaretesting,atleast
besidesgameprogramming,3Dgraphics,audio,high-performanceclustering,
coolwebsites,andsoon?
Okay,sosoftwaretestingislowonthelist.That'sunfortunate,becausegood
softwaretestingcanincreaseyourproductivity,improveyourdesigns,raiseyour
quality,easeyourmaintenanceburdens,andhelptosatisfyyourcustomers,
coworkers,andmanagers.It'snosurprisethattheagiledevelopmenttechniques
placesuchanemphasisonautomatedsoftwaretestingwhenitclicksforyouand
youunderstandit,you'llwonderhowyoueverwrotesoftwarewithoutit.
Perlhasabitofareputationforbeinghackishandunserious.It'scertainlygood
fordoingquickanddirtyjobsquicklyanddirtily.However,ifyouapproachit
withdiscipline,you'llfindthatit'ssuitableforbig,seriousprojects.You
probablyalreadyknowthis.Youmaynotknowhowtoapplythediscipline,
though.That'swherethisbookcanhelp.
Perlhasastronghistoryofautomatedtests.TheearliestreleaseofPerl1.0the
authorsknowofincludedacomprehensivetestsuite.It'sonlyimprovedfrom
there.TheCPAN,ahugearchiveoffreelyavailableandreusablePerlcode,
exertsstrongsocialpressureoncontributorstowriteandmaintaingoodtest
suitesfortheircode.Italsoincludesdozensofusefultestingmodulestomake
testingpossible,oreveneasy.
Ofcourse,yourmainjobprobablyisn'tallPerlallthetime.Itmaybejustoneof
ahandfulofgoodtoolsyouuse.That'sfine.LearninghowPerl'stesttoolswork
andhowtoputthemtogethertosolveallsortsofpreviouslyintractable
problemscanmakeyouabetterprogrammeringeneral.Besides,it'seasytouse
thePerltoolsdescribedhere(andothersthatthefuturewillbring)tohandleall
sortsoftestingproblemsyouencounter,eveninotherlanguages.
Youdon'thavetobeadie-hardfreeandopensourcesoftwaredeveloperwho
lives,breathes,anddreamsPerltousethisbook.Youjusthavetowanttodo
yourjobalittlebitbetter.


WhatThisBookCovers
TheninechaptersofthisbookcovertestinginPerl,startingasifyou'venever
writtenatestbeforeandendingbyexploringsomeofthetestingproblemsyou'll
encounterintherealworld.TheauthorsexpectyoutoknowPerlalreadywell
enoughtoinstallandusePerlmoduleseffectivelyinyourownprograms.You
shouldhaveadecentunderstandingofPerldatastructuresandobject-oriented
programming.YouneedtohavePerlnewerthan5.6.0installed,buttheauthors
recommendatleastPerl5.6.1andsuggestthatyouconsiderupgradingtothe
latestversionofthestable5.8series.
Asforthechaptersthemselves,theydiscuss:

Writingbasictests
Thischapterexplainseverythingyouneedtostartwritingandrunningtests,
includinghowtoinstalltestingmodules,howtounderstandtestresults,and
thebasictestfunctionsyou'lluseineverytest.

Improvingyourtests
Thischapterbuildsonthepreviouschapter,demonstratingfurthertest
techniquesandmodules.Onceyou'refamiliarwithwritingtests,you'll
encountersomecommontasksandtroubles.Here'showtosolvethem.

Organizingandrunningtestswell
Thischaptershowshowtotakeadvantageofthebasictestingtoolsto
customizethemforyourenvironmentandprojects.Inparticular,itshows
howtowriteyourowntestinglibrariesandharnesses.


Bundlingtestsandcodeintoprojects
Testsarejustcode,andallofthenormalrulesofdisciplinedcodingapply.
Thischaptercoverssomeoftheissuesyou'llfacewhenyouwantto
distributeyourproject,especiallytheissuesofnon-codeportionsofyour
project.

Testinghard-to-testcode
Unittestingseemseasyintheory,butcomplexprojectshavecomplex
interactionsthatmightseemimpossiblyuntestableatfirst.Thischapter
claimsotherwise.Itrecommendsanotherwayofthinkingthatallowsyouto
substitutetestablecodeunderyourcontrolforcodethatotherwiselooks
untestable.

Testingdatabasesandtheirdata
Manyprogramsinteractwithdatabases:relational,object,andflatfile.
Whilethesenormallyseemoutsidethepurviewofwhatyoucantestfrom
Perl,therearesimpleandeffectivetechniquestoverifyingthatyourcode
doeswhatitshould.Thischapterdescribesthem.

Testingwebsitesandwebprojects
Layeredapplications,withdisplay,logic,anddatapieces,alsoseem
difficulttotest,especiallyifthey'renotreallylayeredafterall.Thischapter
exploresanalternativewebapplicationdesignstrategythatmakesprojects
easiertomaintainandeasiertotest,too,aswellashowtotestthem.


Unittesting
TraditionalPerltestingdiffersfromxUnit-styletestinginthewayit
organizes,structures,andrunstests.Youcanhavethebestofbothworlds,
though.ThischapterdiscussesaPerltestingframeworkthatallowsgood
codereusewithinobject-orientedprojecttestsandyetworkswithinthe
familiarPerltestinglibraries.

Testingnon-Perlandnon-modules
There'sawholeworldoutsideofPerl.Nowthatyouknowthepower,
flexibility,andeaseofautomatedtestingwithPerl,thischaptersuggestsa
fewwaystouseeverythingyou'velearnedtotestotherprojectswrittenin
otherlanguages.Goforthandimprovesoftwarequalityworldwide.


ConventionsUsedinThisBook
Thisbooksusesthefollowingtypographicalconventions:

Italic
Usedfornewterms,URLs,emailaddresses,filenames,fileextensions,
pathnames,directories,andUnixutilities.

Constantwidth
Usedforprogramlistings,classes,methods,variables,keywords,andthe
outputofcommands.

Constantwidthbold
Usedtoshowcommandsorothertextthattheusershouldtypeliterallyand
tohighlightsectionsofcodeexamples.

Constantwidthitalic
Usedtoshowtextthatshouldbereplacedwithuser-suppliedvalues.

Handwritingfont
Usedfortips,suggestions,orgeneralnotes.


UsingCodeExamples
Thisbookisheretohelpyougetyourjobdone.Ingeneral,youmayusethe
codeinthisbookinyourprogramsanddocumentation.Youdonotneedto
contactusforpermissionunlessyou'rereproducingasignificantportionofthe
code.Forexample,writingaprogramthatusesseveralchunksofcodefromthis
bookdoesnotrequirepermission.SellingordistributingaCD-ROMof
examplesfromO'Reillybooksdoesrequirepermission.Answeringaquestionby
citingthisbookandquotingexamplecodedoesnotrequirepermission.
Incorporatingasignificantamountofexamplecodefromthisbookintoyour
product'sdocumentationdoesrequirepermission.
Weappreciate,butdonotrequire,attribution.Anattributionusuallyincludesthe
title,author,publisher,andISBN.Forexample:"PerlTesting:ADeveloper's
Notebook,byIanLangworthandchromatic.Copyright2005O'ReillyMedia,
Inc.,0-596-10092-2."
Ifyoufeelyouruseofcodeexamplesfallsoutsidefairuseorthepermission
givenabove,feelfreetocontactusatpermissions@oreilly.com.


SafariEnabled

WhenyouseeaSafari®Enabledicononthecoverofyourfavorite
technologybook,itmeansthebookisavailableonlinethroughtheO'Reilly
NetworkSafariBookshelf.
Safarioffersasolutionthat'sbetterthane-books.It'savirtuallibrarythatlets
youeasilysearchthousandsoftoptechnologybooks,cutandpastecode
samples,downloadchapters,andfindquickanswerswhenyouneedthemost
accurate,currentinformation.Tryitforfreeathttp://safari.oreilly.com.


CommentsandQuestions
Pleaseaddresscommentsandquestionsconcerningthisbooktothepublisher:
O'ReillyMedia,Inc.
1005GravensteinHighwayNorth
Sebastopol,CA95472
(800)998-9938(intheUnitedStatesorCanada)
(707)829-0515(internationalorlocal)
(707)829-0104(fax)
Wehaveawebpageforthisbook,wherewelisterrata,examples,andany
additionalinformation.Youcanaccessthispageat:
http://www.oreilly.com/catalog/perltestingadn

Tocommentorasktechnicalquestionsaboutthisbook,sendemailto:
bookquestions@oreilly.com

Formoreinformationaboutourbooks,conferences,ResourceCenters,andthe
O'ReillyNetwork,seeourwebsiteathttp://www.oreilly.com.
ThePerlQAprojecthasawebsiteandmailinglistdevotedtodiscussingand
improvingsoftwaretestingandinPerl.Seethewebsiteathttp://qa.perl.org/for
informationonjoiningthelistaswellaslinkstoothertestingmodules,related
projects,andarticlesandpresentationsonPerlandtesting.


Acknowledgments
Theauthorsthanktheireditor,AllisonRandal,forfindingtherightformatfor
thisbook,fortakingcareofmessylittledetails,andforweighinginwith
editorialadvicewhennecessary.TheauthorsalsothankeveryoneinO'Reilly's
production,marketing,tools,andPRgroupswhoputthisbookinthehandsof
peoplewhoneedit.
Theauthorsalsothankabevyoftechnicalreviewersforthoughtfulsuggestions,
withoutwhichthebookwouldbemuchpoorer.Inalphabeticalorder,theyare
DavidAdler,AnnBarcomb,TonyBowden,ShawnBoyette,JimBrandt,Mike
Burns,BenEvans,ShlomiFish,AdrianHoward,PaulJohnson,JamesKeenan,
PeteKrawczyk,ChristopherLaco,AndyLester,PeteMarkowsky,Tom
McTighe,StevePeters,CurtisPoe,StevenSchubiger,MichaelSchwern,Ricardo
Signes,BrettWarden,andGeoffreyYoung.Anyremainingerrorsarethefaultof
theauthors,orperhapsspacealiens.
Finally,theauthorsthankeveryonewhoseworkhasgoneintothetesting
strategiesandmodulesdescribedhere.Everyone'sbetterforit.

IanLangworth
I'dliketothankbriandfoyfornoticingmyPerltestingquick-referencecardand
hisinitialsuggestiontogettheballrolling.
ThankstotheterrificfacultyandstaffattheCollegeofComputerand
InformationScienceatNortheasternUniversityespeciallytheCCISSystems
Groupfolksandtheirvolunteergroup,theCrew.Theyhaveprovidedmewithan
amazingcommunityovertheyears,towhichIowesomuch.Specialthanks
goestoProfessorRichardRasala,whomentoredmeforthreemonthsinthis
project'searlystages.
ThanksgoestoAndyforallofhishelpandtoAllisonforlettingthishappen.
Allisonalsosetmeupwithabrilliantcoauthor,whosegraspofthelanguage
amazesmetonoend.Thisbookwouldn'tbenearlyasgoodasitiswithout


chromatic'stremendouswritingprowess.
Thankstoallofmygreatfriends(toomanytolisthere),mywonderfulparents,
andtoEmily.Thesepeoplehavebeenwonderfullysupportiveanddeservean
immenseamountofcreditforhavingtoputupwithmeregularly.

chromatic
ThankstoAllisonforsuggestingIworkonthisbookandtoIanforcomingup
withtheideaandacceptingacoauthor.ThankstoeveryoneatO'Reillyfora
fantasticdayjob.ThanksalsotomyfriendswhocelebratedwhenIdidand
commiseratedwhenIcomplained,especiallytheUofPbunchandMel,Esther,
Kate,andEva.Apologiesandlovegotomyfamilyandmostofalltomy
parents,FloydandAnnette,whoknowfullwellthatIlearnedabouttesting
thingsveryearly.Atleastnowithassomeproductivevalue.


Chapter1.BeginningTesting
You'veheardaboutthebenefitsoftesting.Youknowthatitcanimproveyour
code'sreliabilityandmaintainabilityaswellasyourdevelopmentprocesses.You
mayevenknowaboutthewiderangeofavailablemodulesandidiomsthatPerl
offersfortestingPerlandnon-Perlprograms.Inshort,youmayknoweverything
exceptwheretostart.
Thelabsinthischapterwalkthroughthemostbasicstepsofrunningandwriting
automatedtestswithPerl.Bytheendofthechapter,you'llknowhowtostartand
continuetesting,howPerl'stestinglibrarieswork,andwheretofindmore
librariestoeaseyourworkload.


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay

×

×