estparametersplayedback.Forinstance,you'llprobablywanttopluginadifferentusernameandpasswordforeachuniqueuserloggingintothesystem,orsomeuser-specificparametersuchassessionidentifierorproductID.Toprovidevalueslikethis,youcreateatestcomponentcalledadatapool.
Adatapoolisatableofvaluestobesubstitutedforanexplicitstringparameterinarequest.Table1isanexampleofadatapool;thisoneprovidesusernameandpasswordvaluesandisnamed"users."Youcancreateasmanydatapoolsasyouwantwithinaparticularperformancetestproject.Youthenassociatetheentriesinadatapoolwithspecificpartsofarequest.
Table1.Anexampledatapool
Username
Password
SMYTH11
password11
SMYTH12
password12
SMYTH13
password13
SMYTH14
password14
SMYTH15
password15
ThecontentofadatapoolisimportedfromaCSV-formattedtextfileinthefilesystem.CSV(comma-separatedvalue)filescanbecreatedwithastandardtexteditororsavedinCSVformatfrommostspreadsheetprograms.Tocreateadatapool,right-clicktheprojectandselectNew>Datapool,givethedatapoolaname,andspecifytheCSVfiletobeimported.Afilewiththedatapoolnameandtheextension.datapooliscreatedintheproject;theoriginalCSVfileisnolongerneeded.
Onceyou'vecreatedadatapool,youmustassociateitwithatestbeforethecontentofthedatapoolcanbeusedtoreplacetextinarequest.Todothis,openthetestyouwanttousethedatapoolinbydouble-clickingitintheTestNavigatororright-clickingitintheTestNavigatorandselectingOpen.Insidetheopentest,clicktheAddbuttonandselectDatapool.Intheresultingdialog,selectthedatapoolyouwant(thefilewiththe.datapoolextension,nottheCSVfile).
Nowthatyou'veaddedthedatapooltothetest,youcanusevaluesfromittosubstituteforrecordedcontentwithinatest.Let'slookatanexample.Figure3showstheperformancetestrecordedearlierwiththelogintoWebSpherePortalhighlighted.IntheRequestAttributespane,youcanseethePOSTrequestsubmittedforthelogin.Theexplicitusernameandpasswordstringsarevaluesoftheparameterswps.portlets.useridandpassword.PerformanceTesterindicatesthatthesevaluesaregoodcandidatesforsubstitutionwithdatapoolvaluesbychangingthecolorofthetexttogreen.Youcanseethisforthepasswordparameter;thestringfortheuseridparameterhasbeenselected,soyoucan'tseethegreentextthere.(Infact,PerformanceTesterchangesthecolorsofdisplayedtextinseveralsituationsasavisualcuethatthere'smoreinformationaboutthespecifictextthanjustthestringitself.Alloftheseindicatorscanbefound,andedited,inthePreferenceswindowofEclipse:Window>Preferences>Test>PerformanceTestEditor.)
Figure3.AnexampleofdatapoolcandidatesbeinghighlightedintheRequestAttributes
Onceyou'vedeterminedthetextyouwanttosubstituteadatapoolvaluefor,selectthetextandright-clickit.(InFigure3,thisisSMYTH1.)ClickSubstituteFrom>DatapoolVariableonthemenuthatappears,andyou'llseethedialoginFigure4.Selectthecolumncontainingthevaluesyouwant,inourcaseusername,andclicktheUseColumnbutton.
Figure4.The"Selectdatapoolcolumn"dialog
Forthelogintoworkcorrectly,youalsohavetoreplacethevalueofthepasswordparameterwiththepasswordvaluefromthesecondcolumnofthedatapool.Duringaperformancetest,everytimetheloginrequestisissued,thevaluesofusernameandpasswordwillbepulledfromthenextrowofthedatapool.
Performingmanualdatacorrelation
Youcanusedatapoolsifyouknowbeforeexecutingthetestthevaluesthatneedtobesubstitutedintoeachrequest.Butsometimesdynamicinformationisgeneratedbytheserverandinsertedintorequests.Thiscanincludesessionidentifiers,databasetablereferencenumbers,andothersometimescrypticstringsthatcontainstateinformationnecessarytokeeptheclientandserverinsynconmultirequesttransactions.
AnotherincreasinglycommonfeatureofsomeWebframeworksistocreatearicherandmoreresponsiveuserinterfacebyincludingdynamicclient-sideprocessing,throughtheuseofcodesuchasaJavaScript(tm)scriptoraJavaapplet.Whiletheseuserinterfaceadditionsmaketheuser'slifeeasier,theymakethelivesofloadandperformancetestersmuchmoredifficultsincetheactualrequestURLthat'sissuedmaydependonsomesetofdynamicoperationsontheclientthatmaynotberepeatableifrecordedstatically.
Ifyou'relucky,thepieceofdynamicinformationnecessarytoconstructaparticularrequestisprovidedtotheclientfromthepreviousrequest.Thenit'sjustamatterofidentifyingthedynamicpiecesandsearchingfortheminthepreviousresponse.Thisprocessofobtainingcontentfromapreviousresponsetobeusedinsubsequentrequestsiscalleddatacorrelation.PerformanceTesterdoesagoodjobofhelpingtocorrelaterequestdatafrompreviousresponses,anditflagscandidatesforcorrelationbychangingthetextcolortopurple.However,youknowmoreaboutyourapplicationthanPerformanceTesterdoes,soyouneedtoverifyandpossiblymanuallycorrelatetherequestcontent.
Let'slookatourexampleperformancetestagain.InFigure5thethirdstepofthescenariohasbeenexpandedtoshowthefirstrequestissuedaftertheuserloggedintotheportal:
Figure5.Theoriginalcorrelatedrequestinourexampleperformancetest
TherecordedURLisasfollows:
/wps/myportal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLN4h3dAPJgFiWrvqRqCbLGpugijnABb31fj_zcVP0A_YLc0NCIckdFAGQEfGM!/delta/base64xml/L3dJdyEvUUd3QndNQSEvNElVRS82XzBfOUo!
Whatamouthful!There'snowayyoucouldhavepredictedthatURL,anditwillchangeforeachuserandeachiterationofthescript.Buttheclienthadtohavethisinformationcommunicatedtoitsomehow.Howelsewouldthebrowserknowwhatrequesttoissue?Soyouhavetolookforthisinformationinthepreviousresponsedatageneratedfromthelogin.
Followthesestepstoperformthemanualdatacorrelation:
Clearoutanyautomaticcorrelationthat'sbeenperformedbyPerformanceTester.Todothis,selectthecorrelated(purple)text,right-clickit,andselectRemoveSubstitutiononthemenuthatappears.Thiswillbreakthelinkbetweenthesubstitutedtextanditssourceinthepreviousresponse.Inourexample,PerformanceTesterhascorrelatedthebeginningoftheURL,/wps/myportal/!ut/p/kcxml,butnottheentireURL,sothecorrelationforthisstringmustbebroken.
Selectthetexttobecorrelated,right-clickit,andselectSubstituteFrom>FindMoreonthemenuthatappears.ThiswillsearchallofthepreviousresponsesfortheselectedtextandgeneratealistoflinksintheClassicSearchviewvis
上一篇:
VB_net+SQL房地产评估系统(论文和程序)
下一篇:
成本管理详细介绍