Documente Academic
Documente Profesional
Documente Cultură
00
Lab Exercises
COURSE OVERVIEW
In this course, students will learn how to create and execute performance tests using
LoadRunner. Each topic is supported by hands-on exercises that are based on reallife examples designed to provide you with the knowledge necessary to automate
performance testing in the Web environment using LoadRunner. The class focuses on
quality assurance and tool usage, with associated lab work to enforce the skills.
COURSE TOPICS
o
o
o
o
o
o
o
o
o
PREREQUISITES
INTENDED AUDIENCE
QA Managers
Performance Test Team Leads
Performance Test Script Developers
Apr 2011
HP Restricted
LRPage 1
LoadRunner 11 Training
1. Script Recording
In this exercise, you will explore Virtual User Generator UI and its Recording
Options and will perform a basic recording.
Launch and configure demo Application
a. Use LR11 image
b. Verify that Xitami web server is launch (the X icon on the system tray is
displayed). If not, go to the image Desktop and launch Start Web Server
c. On the Desktop, find and launch HP Web Tours application.
d. Click the Sign-up now link and submit your own username and password.
No need to enter First/Last name nor address.
e. Re-launch HP Web Tours application and make sure you can login with
your username and password.
f.
Basic recording
g. On the Desktop, find and launch Virtual User Generator.
h. Select File New for a new script. Make sure New Single Protocol script
and category: Popular protocols are selected. Select Web
(HTTP/HTML) protocol.
LR2
i.
Click OK
j.
HP Restricted
August 2010
HP ALM-QC 11.0
Under General Script make sure Close all AUT processes when
recording stops is enabled.
m. Click OK
n. Click OK on the Start Recording window
o. VuGen (Virtual User Generator) should be converted to a recording toolbar, and
the application should be launched automatically.
p. Login to the application using your newly created <username> and
<password>
q. Click Login
r. Click on Flights button on the left panel
s. On the recording bar, change vuser_init to Action in the Recording
into Action selection box.
t.
Select:
i. Departure City: London
ii. Arrival City: Paris
iii. Enable Round-trip ticket Checkbox
u. Click Continue
v. Click Continue again to take the 1st available flight
w. On the Payment Details page, enter:
i. First Name: <your name>
ii. Last Name: <your name>
iii. Credit Card Number: <any number>
x. Click Continue
y. On the Invoice page, click on Flights button
z. On the recording bar, change Action to vuser_end in the Recording
into Action selection box.
aa. Click on Sign off
bb. Stop recording by clicking on the Stop button.
cc. Save script as exercise1
Apr 2011
HP Restricted
LRPage 3
LoadRunner 11 Training
2. Script Replaying
In this exercise, you will replay the script as well as perform basic configuration on
recording options and runtime settings.
Basic Replaying
a) In VuGen, go to Tools General Options and configure as below:
LR4
HP Restricted
August 2010
HP ALM-QC 11.0
Apr 2011
HP Restricted
LRPage 5
LoadRunner 11 Training
3. Transactions
In this exercise, you will create a transaction within the script and explore transaction
differences between 2 types of recording.
Add Transaction
a) Take script exercise2 and Save As exercise3.
b) Verify that Tree View is selected for the script.
c) Select the Action section
d) Highlight the first step (Welcome.pl)
e) Click on Insert Start Transaction button
f)
g) Highlight the step BEFORE the last step in Action (usually reservations.pl_3)
h) Click on Insert End Transaction button.
i)
j)
Click OK
k) Replay the script. What is the reported transaction time? Where can you find the
information?
Recording Web (Click and Script)
l)
Perform another recording using the steps in Exercise 1, but instead of using Web
(HTTP/HTML) select Web (Click and Script). Save the script as
exercise2a.
s) Click OK
t)
LR6
Replay the script. What is the reported transaction time? It is different from the
transaction time reported in exercise2? Why?
HP Restricted
August 2010
HP ALM-QC 11.0
Review Questions
a) Why is transaction reported in exercise2a different from that reported in
exercise3?
b) What are some other ways you can insert a new transaction to the script?
Review Answers
a) VuGen is trapping recording events at different communication level when using
Web (HTTP/HTML) versus Web (Click and Script). Web (HTTP/HTML) is
trapping at the HTTP level, while Web (Click and Script) is trapping at the
DOM (Document Object Model). Since during replay the time needed for Web
(HTTP/HTML) script is less (communicating at a lower HTTP level and bypassing
the DOM level, the reported transaction time is less.
b) Transaction can be inserted using drag and drop method in Task View, and
transaction can also be inserted during recording, which is the recommended way
since we dont need to understand where exactly within the script is the start and
end of the transaction.
Apr 2011
HP Restricted
LRPage 7
LoadRunner 11 Training
4. Parameterization
In this exercise, you will create a parameter inside the recorded script.
Create a Parameter
a) Open script exercise3 and save it as exercise4.
b) Set the script in the Tree View, highlight the step Submit Form:
reservations.pl
c) Right-click and select properties
d) Click on the ABC button next to the numPassenger field.
e)
f)
g)
h)
i)
j)
k)
l)
m)
n)
o)
LR8
August 2010
HP ALM-QC 11.0
Review Questions
a) Which VuGen script step should you implement against for exercise step q)?
b) What will happen if invalid data (e.g. A departing city not shown in the application
drop-down list) is being entered as a parameter value?
Review Answers
a) Usually step Submit Form: reservations.pl_3. This is the step where you can
find the first and last name to be submitted to the web server.
b) The replay will fail. As a pre-requisite, all load test data should be verified before
usage.
Apr 2011
HP Restricted
LRPage 9
LoadRunner 11 Training
5. Verification
In this exercise, you will implement a text verification within the recorded script.
a) Take script exercise4 and save as exercise5.
b) In Tree View, go to step Submit Form: reservations.pl_3
c) Go to the HTML View on the right. On the Recording Snapshot, highlight
Thank you for booking through WebTours
d) Right-click and select Add a Text Check (web_reg_find)
e) Enable Save Count checkbox and name it Count
f)
LR10
Replay the script. How many occurrences do we have for the text?
HP Restricted
August 2010
HP ALM-QC 11.0
6. Correlation
In this exercise, you will fix a correlation issue within the script.
a) Open script exercise3 and save it as exercise6.
b) Create 2 parameters against the departure and arrival city and name them FromCity
and ToCity respectively.
c) Set the parameter with 2 rows of data:
i. London,Paris
ii. San Francisco,Sydney
d) Set Runtime Settings Run Logic to run 2 iterations.
e) Replay the script. Did it work? Why or why not?
f)
Apr 2011
HP Restricted
LRPage 11
LoadRunner 11 Training
e) Create a new SLA with Total Hits per run for the whole scenario with value =
200.
f)
Go to Run tab and setup a windows resource monitoring with the default resource
measurement.
g) On the Controller, on the menu bar, select Results Result settings and make a
note of where the result directory is. (i.e. the Directory box)
h) Save the scenario as exercise7.
i)
LR12
August 2010
HP ALM-QC 11.0
j)
k) How many
i. Passed Transactions,
ii. Failed Transactions,
iii. Hits/Second did the scenario achieved?
iv. Any errors?
Review Questions:
a. In the New Scenario window, how do we know the absolute path of the
script?
b. How many vuser licenses will this scenario use? Where do you see that?
c. Was the actual vuser running behavior exactly the same as what dynamic
schedule predicts? Why or why not?
d. Where can we find whether the scenario achieves its load testing goal?
Review Answers:
a. Right-click on any script and select Show Path
b. if the Initialize each vuser before it runs is selected, the scenario will
use 4 vuser license maximum, since the maximum number of both initialized
and running vusers will be 4. On the other hand, youll need 6 (4 + 2) vusers
if Initialize all vusers simultaneously is selected.
c. The runtime schedule is usually different from what is shown in the dynamic
scheduler, in part because time needed to initialize a vuser might be
unpredictable, plus operators can manually change behavior of the run by
adding or stopping vusers.
d. We can only obtain this information under Analysis.
Apr 2011
HP Restricted
LRPage 13
LoadRunner 11 Training
8. Result Analysis
In this exercise, you will explore Analysis application and generate graphs and
reports.
a) On the LR 11 image Desktop, open the Enablement Folder.
b) Locate \result1\ Validation01_09-30-05.lra. Double-click to launch it.
c) Go to Summary Report item on the left panel, what should testers report the
transaction time of S1 T04 ECHO Login to be?
d) Play around with features like granularity, merge graphs, drill-down, autocorrelateetc
Review Questions:
e. What should be reported as transaction time for S1 T04 ECHO Login?
Review Answers:
e. A more accurate number should be the 90th Percentile, reporting 6.732.
LR14
HP Restricted
August 2010