junit.docx
- 文档编号:13484961
- 上传时间:2023-06-14
- 格式:DOCX
- 页数:25
- 大小:179.74KB
junit.docx
《junit.docx》由会员分享,可在线阅读,更多相关《junit.docx(25页珍藏版)》请在冰点文库上搜索。
junit
LoadTestingWebApplicationsusing
Microsoft’sWebApplicationStressTool
ByRickStrahlhttp:
//www.west-
LastUpdated:
10/17/2018
Microsoft'sWebApplicationStressToolprovidesaneasywaytosimulatelargenumbersofusersagainstyourWebapplication.Thistoolmakesitpossibletomakeintelligentdecisionsabouthardwareandsoftwareloadincurredbyyourapplicationandhowmuchtrafficagivenmachineorgroupofmachinescanhandle.InthisarticleRickshowshowthetoolworksandhowtoproperlyinterprettheperformancedataitgenerates.
FreeDownloadfrom:
Requires:
WindowsNT4.0SP4orWindows2000
BuildingWebapplicationshasnowbecomeafairlycommonscenariofordevelopersbuildingnewapplicationsorupdatingandWebenablingexistingapplications.AsapplicationsmovetotheWebintoaserverbasedenvironmentitbecomesincreasinglyimportanttobeabletogaugetheperformanceandloadcapabilityofanapplication.Developersmustbeabletoanswerhardquestionsabouthowmuchtrafficagivensitewillbeabletohandleandmakeintelligentchoicesofhardware,softwareandoftentimesevendesignapproachoftheapplicationtomakesuretheapplicationwillbeabletohandleanonslaughtofcustomersontheWebsite.Weshouldallbesoluckytohavetoworryabouttheproblemofbeingtoosuccessful!
Butit'softensurprisingtofindhowmanyWebsiteshittheirlimitsandcatchtheoperatorsoffguard.AnoverloadedWebsiteisamajorproblemandoncehappeningtheproblemoftencan'tbeaddressedrapidly.Aquickfixtypicallyinvolvesaddingadditionalhardwarethatmustbepurchased,installedandconfigured–aprocessthatmaytakedaysorevenweeks.Beingpreparedandunderstandingthelimitsofanapplicationandmanagingadvertisingtobringtraffictoasiteinmeasuredspurtsiscrucialtothesuccessoflargeandevennotsolargecommercialsites.
Additionally,it'simportanttounderstandthattoday'stoolsoftenmakeitmucheasiertobuildWebapplicationsthanthetoolsfromevenayearago.Todaywehavepowerfulscriptingengines,easyaccesstoCOMcomponentswecanwriteinhighlevellanguagesandWebserversthatself-configureforthemostpart.Butalongwiththeeaseofusealsocomesmoreoverheadandresourceloadontheserveranditbecomesevenmoreimportanttolookatloadissuesrightfromthestartofapplicationdevelopment.Loadtestingshouldbeperformedintheinitialdesignphasestogetagoodideawhatoverheadtheapplicationcomponentsincurontheserver.Constantmonitoringshouldbeperformedasdevelopmentcontinuesonalwayskeepingacloseeyeonhowwellthesoftwareplatforminrelationtothehardwareitwillberunningon.
Theproblemisthatoftentimesthesescalabilityquestionssuchas'Howmuchtrafficcanwehandleonourparticularhardware?
'arenoteasilyansweredbecauseit’shardtomeasureperformanceofWebapplicationsoutsidetheactualenvironmentthattheywillberunningin.EventheprocessoftestingWebapplicationsseemsdaunting:
TherearesomanypiecesinvolvedfromaWebbrowserclient,theWebserver,thebackendapplicationandthebackenddatabaseserver.ThebottomlineisthattheonlywaytorealisticallytesttheloadcapabilitiesofaWebapplicationisinacloseapproximationofaliveenvironment,whichmeansactually'running'theWebapplication.
IntroducingtheWebApplicationStressTool
So,howdowe'run'aWebapplicationrealistically?
Theansweristhatyouhavetosimulatemanyclientssimultaneouslyhittingyoursite.Tothisend,Microsofthasreleasedaneasytouse,yetverypowerfulandflexibletoolcalledtheWebApplicationStresstool(WAS),whichprovidesthisfunctionalityinafreelydownloadableapplicationservice.
Figure1–TheWebApplicationStresstoolprovidesasimpleinterfacetocapture,configure,runanddisplaytheresultfromrunningastresstest.InthisviewthecapturedWeblinksthatwillbeaccessedbytheWebclientwhenrunningthetestarelisted.
WASrequiresWindowsNTorWindows2000asthetoolrunsasanNTService.Forrealisticperformancetesting,it'salsorecommendedthatyourunthestresstestingtoolfromaseparatemachineotherthantheWebserver.TheactualrequestgeneratorcanbefairlyresourceintensivewhilegeneratingtheWebrequestsandthisoverheadcanaffectperformanceoftheWebsiteundermaxloads.However,eventhoughthedocumentationstatestwomachinesarearequirementyoucancertainlyrunWASonthesamemachineastheWebserver,butdon'texpect100%accurateresultsespeciallywhenyou'retestingatthetopendloadforthehardwareyou'rerunningon.
TheuserinterfaceofWASisstraightforwardwithalistofscriptsandsublistsofthepropertiesfortheparticularscriptontheleftandadataviewontheright.Thedataviewdependsontheselectedscriptoption.Themostimportantviewsarethedefaultview(seeFigure1)thatshowsyouallselectedlinksandtheserveryou'retestingandtheSettingsview,whichconfigureshowthelinksareexecutedagainsttheserverandatwhatloadlevel.Otheroptionsallowyoutoconfigureuserswithusernamesandpasswords(optional)sinceyoucansimulatelargenumbersofclientsthismaybenecessaryforsitessecuredwithsomelevelofauthentication.Youcanevenconfigurespecificpre-existingCookievaluesforeachuserifyouhaveto.Inshort,therearealotofoptionsformostHTTPscenariosavailable,eventhoughmostoftheseareunlikelytobeutilizedintypicaltests.It'sthereforyouifyouneedthecontroltocustomizeyourtests.
Onceatesthasbeencompletedthere'sareportviewwhereyoucanviewtheresultsofthetest,whichprovidesathoroughsummaryofthetestjustperformedincludinginformationabouttotalhitsandhitspersecondasawhole,hitsforindividualpages,failuresandresponsecodesaswellasbandwidthbreakouts.
Figure2–Thereportpageprovidesasummaryofthetestrunincludingtotalnumberofrequests,requestspersecondandfailures.There'salsoadditionaldetailabouteachlinkandaveragerequesttimesofeachlink.
GettingstartedwithWAS
TheconceptbehindWASissimple:
YoucreateatestscriptbycapturingabrowsersessionusingInternetExplorerbasicallywalkingthroughyourapplication,asatypicaluserwoulddo.AsyoudothisWAScapturesthecontentofalltheseWebrequests.WAScaptureseverything:
Hyperlinkclicks,Formsubmissions,RedirectlinksandAuthenticationinfo–everythingneededtocapturetheuser'ssessionthroughyoursite.
Figure3–TheBrowserRecorderletsyouuseyourbrowsertocreatescripts.Therecordercapturesalllinks,HTMLformsubmissionsandevenCookies,RedirectsandAuthenticationinformation.
Creatingascriptisveryeasy:
YoucanusetheBrowserRecordertocaptureabrowsersessionandhaveWASgenerateatestscriptfromcapturedlinks.Amanualmodeisalsoavailabletoallowyoutomanuallyaddlinksandinformationabouteachlink.
AsyoucanseeinFigure3thereareafewoptionsyoucanchoosefortheBrowserRecorder:
Capturedelay,andrecordcookiesandhostheaders.Thedelaybetweenrequestswillresultamorerealistictestintermsofhowpeopleareactuallynavigatingasite,givingyouamoreaccuratepictureofhowusersonasitemaptoconnectionsontheWebserver.Ifyourgoalistofindthelimitsofyoursiteleavethisoptionunchecked.Ifyouwanttosimulateaspecificusernumberscenariogoaheadandcapturethedelayasitprovidesamorerealisticviewofthebrowsingscenario.I'lltalkmoreaboutthisdelaywhenwelookattheloadoptionsforthetest.
TheRecordbrowsercookiesandRecordhostheaderoptionsallowyoutocaptureaspecificusersession,ratherthandynamicallytrackingthisinformationatthetimeoftherequest,thelatterofwhichishowatypicalbrowserwouldbehave.Typicallyyou'llwanttoleavethoseoptionsuncheckedtolettheWASclientcreatecookiesandhostheadersjustlikeauseronyoursitewould.However,ifyouhavepersistentstateinformationforyoursite(suchasauserprofileorotherinfothatisconnectedtoapermanentcookie)makesurethatyouclearthecookiebeforeyourunyourteststosimulateanewusercomingtothesiteandgoingthroughthestepsofconfiguringtherequireduserstate.Forexample,onmyWebStoresiteuserssetupauserprofilewhentheyplaceanorder.TheprofileisrecoveredwhentheyreturntothesiteandtrackedwithaCookie.IfIneverwentthroughandsetupmyprofileinformationWASwouldnotbeabletoactuallyprocessanorderbecausetheprofileinformationwouldbemissingandnotgetfilledout.
IfyoutypicallyrequireuserswithanestablishedcookieandprofilethenmakesurethatyoudochecktheCapturebrowsercookieoption.
Note:
ThecurrentversionoftheWASBrowserRecorderdoesnotsupportHTTPS/SSLrequestsatthistime.TocapturerequestssecurerequestsyouhavetotemporarydisableSSL(临时禁用SSL).IfyouhavetohaveSSLforaccuratetesting,youcanthenmanuallychangetheindividualrequestsinthelinklistandenableSSLoperationonthem.
WhenyouclickNext|Finishonthebrowserrecorderyou'llbewhiskedintoIEandyou'rereadytocapturerequestsinyourbrowser.InmycaseIranatestagainstmyWestWindWebStoreonmydevelopmentmachinestartingwiththehomepageandtypingthatlinkintothebrowser'saddressline.AfterthatI'moffonmydevsiteandwithWAScapturinglinks.ThissitehappenstobeWebstoreapplicationthatreliesonCookiestotrackusers,handlesprofileinformationforcustomersandsecureorderprocessingviaHTT
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- junit
![提示](https://static.bingdoc.com/images/bang_tan.gif)