You are on page 1of 15

Phn 5: To mt Scenario Load Test

Khi chng ta chy test, LoadRunner to ra ti trn ng dng. Sau chng ta c th s dng nhng biu v gim st hiu qu lm vic ca ng dng trong iu kin lm vic thc t trong i sng. Trong chng ny chng ta s tm hiu cc ch sau: Gii thiu v LoadRunner Controller. Lm cch no chng ta chy load test scenario? Lm cch no chng ta gim st ng dng di ti? Lm cch no chng ta theo di mt user ang chy theo thi gian thc? Chng ta c th xem bn tm tt cc hnh ng ca user u? Lm cch no chng ta c th tng ti trong qu trnh ang test? Lm cch no ng dng i ph di ti? ng dng c m li trong qu trnh test khng? Lm cch no chng ta bit qu trnh test kt thc? ng dng c thc thi tt di ti khng?

Gii thiu v LoadRunner Controller


Controller cung cp cho bn tt c cc cng c bn cn gip bn xy dng v chy test chnh xc trong mi trng m phng ca bn.

Lm cch no chng ta chy load test scenario?


b u pht trin mt scenario, b m LoadRunnerController. 1. M HP LoadRunnerController. Chn Start > All Programs > HP Software > HP LoadRunner > Controller, hoc click biu tng Controller trn mn hnh

The HP LoadRunnerController c m v hin th New Scenario box.

2. Chn mt kiu scenario. C hai kiu: - Manual Scenario cho php bn iu khin da trn s Vusers nag chy v thi gian m chng chy, v cho php bn kim tra bao nhiu Vusers c th chy ng thi trong ng dng ca bn. - Goal-Oriented Scenario c s dng quyt nh xem h thng ca bn c th t c mt mc ch ring bit. V d nh xc nh thi gian p ng transaction hoc s transactions mi giy. LoadRunner s t ng xy dng mt scenario cho mc ch ca bn Click Manual Scenario. 3.Thm mt Vuser script ti load test. Trong hng dn ny bn s ch s dng nh l mt mu ca mt nhm ngi s dng n thc thi cc hot ng ging nhau . c s m phng chnh xc mt scenario ca th gii thc vi nhiu ngi dng khc nhau, bn c th to mt s nhm Vuser khc nhau vi mi nhm chy mt vi on scripts vi cc thit lp ngi dng khc nhau. Script bn ghi phn trc trong VuGen cha mt lot cc xa l m bn mun kim tra. Bao gm vic ng nhp, tm chuyn bay, mua vBn s thm mt script tng t trong scenario v cu hnh scenario m phng 8 ngng dng cng lc t cc chuyn bay.Bn s thm hai hoc nhiu Users trong qu trnh kim tra. Vi mc ch ny , mt script tng t c cung cp . Chng ti khuyn co bn nn s dng cng mt script ging a. Trong New Scenario box, click nt Browse.

b. Chn basic_script trong th mc <LoadRunner Installation>\Tutorial. c. Click Open. Tiu basic_scriptscript c hin th trong Available Scripts v Scripts in Scenario ca New Scenario box. d. Click OK. LoadRunnerController c m v hin th Design tab ca scenario mi.

Nhn tng qut Controller Run


Design tab ca Controller l giao din chnh cho vic thit k cc load test ca bn. Design tab c chia thnh 3 phn 1. Scenario Groups pane 2. Service Level Agreement pane 3. Scenario Schedule pane

1. Scenario Groups. Bn cu hnh nhm Vuser groups trong Scenario Groups . Bn to cc nhm khc nhau i din cho cc ngi s dng ca h thng v xc nh s Vusers s chy v my m chng s chy. 2. Service Level Agreement.Khi bn thit k mt load test scenario,bn c th nh ngha mc tiu hoc SLAs (Service Level Agreements) cho vic thc thi.Khi bn chy scenario,LoadRunner tp hp v lu tr cc d liu lin quan. Khi bn phn tch qu trnh chy , Analys so snh d liu ny vi SLAs v quyt nh trng thi cho php nh ngha php o 3. Scenario Schedule. Trong Scenario Schedule,bn thit lp cch ng x chnh xc m t ca ng x ngi dng trong th gii thc.Bn nh ngha cc hnh ng thng qua Vuser s chy, tc m load test p dng cho ng dng, thi gian load test v bng cch no load test c hy b

Lm cch no chnh sa chi tit script ?


Bn chnh sa chi tit scipt theo cc bc sau 1. Kim tra xem basic_script xut hin trong ct Group Name ca Scenario Groups

2. Thay i Group Name. a. Trong Scenario Groups , chn basic_script v click nt Details. The Group Information box c m. b. Trong Group Name box, g vo mt tn c ngha hn v d travel_agent. c. Click OK. Tn mi c hin th trong Scenario Groups ca Design tab.

Lm th no to mt load test?
Sau khi bn thm Vuser scipts ca bn ti scenario bn cu hnh load generators , my tnh m to ti trn h thng. Mt load generator l mt my chnh m chy nhiu Vusers theo th t to mt load trn h thng. Bn c th s dng s load generator mi mt load generator t nhiu Vusers.Trong phn ny bn s hc v vic thm mt load generator t scenario v kim tra kt ni generator 1. Thm mt load generator. Click nt Load Generators c m. trn thanh cng c Controller. Load Generators box

Load Generators box cho php bn xem v cu hnh load generator c nh ngha trong trong scenario. Load Generators box cho thy chi tit cho mt load generator gi l localhost. Trng thi ca localhost load generator l Down.iu ny ch ra rng Controller khng kt ni ti localhost load generator. Trong hng dn ny bn s s dng my tnh ca bn nh mt load generator. Ch trong hot ng h thng bn s to vi load generator mi my nhiu Vusers 2. Kim tra kt ni load generator. Khi bn chy ascenario, the Controller kt ni ti load generators t ng. Tuy nhin ,bn c th kim tra kt ni trc khi chy scenario. a. Trong Load Generators box, chn localhost v click Connect. Controller c gng th kt ni ti my load generator. Khi mt kt ni c to, Status ca load generator thay i t Down thnh Ready.

b. Click Close.

Lm th no m phng cc ng x t ngi dng?


Sau khi thm load generators, bn sn sng load behavior. Ngi dng khng ng nhp v ng xut h thng cng mt lc. LoadRunner cho php ngi s dng ng nhp v ng xut t t. N cng cho php bn quyt nh thi gian ca scenario, v cch scenario chm dt. Bn cu hnh cho cch ng x ca scenario trong Scenario Schedule ca Controller. Scenario Schedule c chia lm 3 phn : - Schedule Definition area - Actions grid - Interactive Schedule graph. Bn c th thay i thit lp mc nh v cu hnh schedule. 1. Chn schedule type v run mode. Trong Scenario Schedule, chc chn rng that Schedule by: Scenario v Run Mode: Real-world schedule c chn.

2. Thit lp nh ngha cc scheduled action.

Bn c th thit lp Start Vusers, Duration, v Stop Vusers cho scenario schedules t Global Schedule grid, hoc thao tc trn the Interactive Schedule graph. Khi bn thit lp nh ngha t graph ,cc thuc tnh ca Global Schedule grid s thay i cho ph hp Bn s thit lp nh ngha sao cho Global Schedule grid ging hnh bn di.

a. Thit lp khi to Vuser. Khi to ngha l chun bVusers v load generators cho mt load test run bng vic chy vuser_init action trong script. Khi to Vusers trc khi bt u chy gim bi s tiu th CPU v cung cp kt qu chnh xc i. Double-click Initialize trong Global Schedule grid. Edit Action box c m hin th Initialize action.

ii. Chn Initialize all Vusers simultaneously. iii. Click OK. b. Xc nh cc bc khi ng cho Vusers i. Double-click Start Vusers trong Global Schedule grid. Edit Action box c m hin th Start Vusers action.

ii. Trong Start X Vusers box, g 8, v chn ty chn th 2 2 Vusers mi 00:00:30 (30 seconds). iii. Click OK. c. Lp lch thi gian. Bn xc nh mt thi gian chc chn Vuser tip tc thc thi cc action trong lch trnh cho mt thi k xc nh .Nu bn thit lp mt thi gian, script s chy cho mi ln lp mt thi gian cn thit nh mt thi k . i. Chc chn rng the Interactive Schedule Graph trong Edit mode bng vic clicking Edit Mode button trn Interactive Schedule Graph toolbar. ii. Trong Interactive Schedule Graph, click the horizontal line which represents Duration. The line is highlighted v adot v adiamond are displayed at its endpoints. Note that if the Legend is displayed ontop of the diamond, click the Hide Legend button onthe Interactive Schedule Graph toolbar hin th the diamond. iii. Drag the diamond shaped endpoint tothe right until the time inbrackets reads 00:11:30. You have just set the Vusers torun foraperiod of 10minutes. d. Schedule agradual closure. Gradually stopping Vusers is recommended tohelp detect memory leaks v check system recovery, afterthe application has reached athreshold. i. Double-click Stop Vusers trong Global Schedule grid. The Edit Action dialog box c m hin th the Stop Vusers action.

ii. Chn the second option v enterthe following values2 Vusers every 00:00:30 (30 seconds). iii. Click OK.

Lm th no m phng cc loi ngi dng khc nhau?


1.M thit lp run-time. a. Trong Controller, click Design tab. b. Trong Scenario Groups, chn travel_agents group. c. Click nt Run-Time Settings Run-Time Settings box c m. trn thanh cng c Scenario Groups. \

Run-time cho php thit lp cc ngi s dng vi hnh ng v cch ng x khc nhau .Chng bao gm Run Logic. Thi gian m Vuser lp li chui hnh ng. Pacing. Thi gian ch gia cc action

Log Ghi li thng tin qu trnh test Think Time Thi gian ngi dng dng li phn ng li vi cc p ng Speed Simulation. Ngi dng s dng cc loi kt ni khc nhau nh modem, DSL, v cable. Browser Emulation. Ngi s dng dng cc trnh duyt khc nhau Content Check Pht hin li t ng . 2. Enable think time. a. Trong Run-Time Settings box, click General > Think Time. b. Chn Replay think time, v chn Use random percentage of recorded think time. c.Xc nh ti thiu 50% v ti a 150%.

The above specifications use arvom percentage of the recorded think time toemulate users with avarying range of proficiency. Forexample, if the recorded think time for chning aflight was 4seconds, the rvom think time could beanything between 2-6 seconds (50% to150% of 4). 3. Enable logging. a. Trong Run-Time Settings box, click General > Log. b. Chn Enable logging. c. Di Log options, chn Always send messages. d. Click Extended log, v chn Data returned by server. e. Click OK ng Run-Time Settings dilog box.

Lm th no gim st h thng di ti?


By gi bn xc nh Vusers bn s c x nh th no trong khi th nghim, bn sn sng thit lp mn hnh ca bn.Trong khi to ra mt ti v mt ng dng, bn mun xem cch thc ng dng thc hin trong thi gian thc v ni tc nghn tim nng s dng b mn hnh tch hp ca LoadRunner o lng hiu sut ca tt c cc thnh phn server tng, , ca h thng trong qu trnh ti th nghim.

LoadRunner bao gm mn hnh cho mt lot cc thnh phn h thng ph tr bao gm Web, ng dng, c s d liu, v my ch ERP / CRM. V d, bn c th chon mt ti nguyn my ch web theo di theo loi ca my ch Webang chy. Bn c th mua mt giy php cho mn hnh c lin quan, v d nh IIS, v s dng theo di xc nh cc vn phn nh trong IIS ti nguyn. Trong phn ny, bn s tm hiu lm th no thm v cu hnh Windows Ti nguyn mn hnh. bn c th s dng mn hnh ny xc nh tc ng ca ony ti CPU a, ca chng ti, v ti nguyn b nh.1. Chn the Windows Resources Monitor. a. Click the Run tab at the bottom of the Controller. The Windows Resources graph is one of fourdefault graphs that are displayed trong graph viewing area. You will learn how m othergraphs trong next lesson.

b. Right-click inside the Windows Resources graph v chn Add Measurements. The Windows Resources dialog box c m.

2. Chn the monitored server. a. Trong Monitored Server Machines section of the Windows Resources dialog box, click Add. The Add Machine dialog box c m.

b. Trong Name box, type localhost. (If yourload generatorwas running off adifferent machine you would type the servername orIP address of that machine.) c. From the Platform list, chn the platform onwhich the machine runs. d. Click OK. The default Windows Resources measurements are listed underthe Resource

Measurements on <server machine>.

3. Activate the monitor. Click OK trong Windows Resources dialog box ng the dialog box v activate the monitor.

You might also like