1
HP LoadRunner Quick Start
Welcome to the HP LoadRunner Quick Start. The Quick Start provides a
short, step-by-step overview and introduction to using LoadRunner.
LoadRunner tests load on your application by emulating an environment in
which multiple users work concurrently. While the application is under
load, LoadRunner accurately measures, monitors, and analyzes a system’s
performance and functionality.
Introducing LoadRunner Technology
Using HP LoadRunner, you create scenarios in which you define the events
that occur during a performance testing session. In the scenario,
LoadRunner replaces human users at physical machines with virtual users,
or Vusers. These Vusers create load on your system by emulating actions of
typical users in a repeatable and predictable manner.
Suppose you were testing a Web-based travel agency application that
enables users to book flights online, and you wanted to determine how the
application behaves when multiple users try to perform the same
transaction at the same time. Using LoadRunner you could create a scenario
in which 1000 Vusers, replacing 1000 travel agents, would simultaneously
try to book a flight on your application.
HP LoadRunner Quick Start
2
The Testing Process
The LoadRunner testing process consists of four basic steps:
➤ Step 1-Creating the Script. Capturing typical end-user business processes
that are performed on your application.
➤ Step 2-Designing the Scenario. Setting up the load test environment by
defining events that occur during the testing session.
➤ Step 3-Running the Scenario. Driving, managing, and monitoring the load
test.
➤ Step 4-Analyzing the results. Analyzing the performance data generated by
LoadRunner during the load test.
LoadRunner Components
Each step in the testing process is carried out by one of the HP LoadRunner
components. The components are as follows:
➤ HP Virtual User Generator (VuGen). Creates the script.
VuGen generates virtual users, or Vusers, by recording actions that typical
end-users would perform on your application. VuGen records your actions
into automated Vuser scripts, which form the foundation of your load tests.
➤ HP LoadRunner Controller. Designs and runs the scenario.
The Controller is the central console from which you build, manage, and
monitor your load test. You use the Controller to run a script that emulates
the actions performed by a real user, and create load on your system by
having a number of Vusers concurrently perform these actions.
➤ HP Analysis. Analyzes the scenario.
HP Analysis provides graphs and reports with in-depth performance analysis
information. Using these graphs and reports, you can pinpoint and identify
the bottlenecks in your application and determine what changes need to be
made to your system in order to improve its performance.
HP LoadRunner Quick Start
3
Sample Application - HP Web Tours
To illustrate the HP solution, this Quick Start uses a sample Web-based travel
agency application system called HP Web Tours. HP Web Tours users
connect to a Web server, search for flights, book flights, and check flight
itineraries.
In the course of this Quick Start you will go through the basic steps of
creating, running, and analyzing a load test using the LoadRunner
components—VuGen, Controller, and Analysis. The test will emulate 10
travel agents simultaneously using the flight reservation system (for
example, logging on, searching for flights, purchasing flights, and logging
off).
Start the Sample Web Server
The Web server should automatically start after the LoadRunner installation.
If the server is not running, select Start > Programs > HP LoadRunner >
Samples > Web > Start Web Server. If you try to start the Web server and it is
already running, an error message appears. You can disregard the message
and continue with the Quick Start.
HP LoadRunner Quick Start
4
Creating the Script with VuGen
The first step in creating your load test is to use VuGen to record a typical
end-user business process. VuGen works on a record-and-playback principle.
As you walk through a business process on your application, VuGen records
your actions into automated scripts which will later form the foundation of
your load tests.
How do I start recording user activity?
You begin by opening VuGen and creating a blank script.
1 Start LoadRunner.
Select Start > Programs > HP LoadRunner > LoadRunner. The
HP LoadRunner 11.00 window opens.
2 Open VuGen.
In the LoadRunner Launcher pane, click Create/Edit Scripts. VuGen’s Start
Page opens.
HP LoadRunner Quick Start
5
3 Create a blank Web script.
In the VuGen Start Page, click the New Vuser button. The New Virtual User
dialog box opens, showing the screen for a New Single Protocol Script.
A protocol is the language that your client uses to communicate with the
back-end of the system. HP Web Tours is a Web-based application, so you
will create a Web virtual user script.
Make sure the Category type is All Protocols. VuGen displays a list of all of
the available protocols for a single protocol script. Scroll down the list, select
Web (HTTP/HTML), and click Create to create an empty Web script.
Note: To record the business process using HP’s new Web (Click and Script)
technology, select Web (Click and Script). For more information on Web
(Click and Script), see “Appendix: Using Web (Click and Script)” on page 25.
An empty script opens in VuGen’s wizard mode with the Tasks pane
displayed on the left.
HP LoadRunner Quick Start
6
If the Tasks pane is not displayed, click the Tasks button on the toolbar.
VuGen’s wizard takes you through a step-by-step process of creating a script
and then adapting it to your test environment. The Tasks pane lists each
step or task in the script creation process. As you proceed through each step,
VuGen displays detailed instructions and guidelines in the main area of the
window.
HP LoadRunner Quick Start
7
How do I record a business process to create a script?
The next stage in creating user emulation is recording the events performed
by a real user. In the previous section, you created an empty Web script.
Now you can begin to record events directly into the script. In this section,
you will track the events of one passenger reserving a flight from Denver to
Los Angeles and then check the itinerary.
To record the script:
1 Start recording on the HP Web Tours site.
a In the Tasks pane, under Recording, click Record Application.
b Click Start Recording at the bottom of the instruction pane. The Start
Recording dialog box opens.
In the URL Address box, type http://localhost:1080/WebTours. In the Record
into Action box, select Action. Click OK.
A new Web browser opens, displaying the HP Web Tours site.
Note: If there is an error opening the site, make sure that the Web server is
running. To start the server, select Start > Programs > HP LoadRunner >
Samples > Web > Start Web Server.)
HP LoadRunner Quick Start
8
The floating Recording toolbar opens.
2 Log on to the HP Web Tours site.
In the HP Web Tours home page, enter the user credentials. For the
Username enter jojo and for the Password enter bean. Click Login. A
welcome page opens.
3 Enter flight details.
Click Flights. The Find Flight page opens:
➤ Departure City: Denver (default)
➤ Departure Date: Keep the default, current date
➤ Arrival City: Los Angeles
➤ Return Date: Keep the default, tomorrow’s date.
Keep the rest of the default settings and click Continue. The Find Flight
(flight selection) page opens.
4 Select a flight.
Click Continue to accept the default flight selections. The Payment Details
page opens.
5 Enter payment information and book flight.
Enter 12345678 in the Credit Card box and type 01/10 in the Exp Date box.
Click Continue. The Invoice page opens, displaying your invoice.
6 Check the itinerary.
Click itinerary in the left pane. The Itinerary page opens.
7 Click Sign Off in the left pane.
HP LoadRunner Quick Start
9
8 Click Stop on the floating toolbar to stop the recording process.
Once the Vuser script has been generated, the VuGen wizard automatically
proceeds to the next step in the Tasks pane and displays the recording
summary which includes the protocol information and a list of the actions
created during the session. For each step you performed during recording,
VuGen generated a snapshot, a picture of the window during recording.
Thumbnails of these recorded snapshots are displayed in the right pane.
9 Select File > Save or click Save. Type basic_tutorial in the File name box and
click Save. VuGen saves the file in the LoadRunner script folder and displays
the script name in the title bar.
How do I view the script?
You can now view the recorded script in VuGen. You can view the script in
Tree view or Script view. Tree view is an icon-based view that lists the
actions of the Vuser as steps, while Script view is a text-based view that lists
the actions of the Vuser as functions.
Tree View
To view the script in Tree view, select View > Tree View or click the Tree
button on the toolbar. For each step you performed during recording,
VuGen generated an icon and a title in the script tree.
In Tree view, you see the actions of the user as script steps. Most steps are
accompanied by a corresponding snapshot of the recording.
Script
Tree
Snapshot
HP LoadRunner Quick Start
10
Script View
Script view is a text-based view that lists the actions of the Vuser as API
functions. To view the script in Script view, select View > Script View or click
the Script button on the toolbar.
In Script view, VuGen displays the script in an editor with color-coded
functions and their argument values. You can type C or LoadRunner API
functions, as well as control flow statements, directly into this window.
How do I verify that the script recorded my actions?
Once you have finished recording, you can replay the script to verify that it
accurately emulates your recorded actions.
To replay the script:
1 Ensure that the Tasks pane is displayed (If not, click the Tasks button in the
toolbar). Click Verify Replay in the Tasks pane, and then click the Start
Replay button at the bottom of the instruction pane.
2 If the Select Results Directory dialog box opens and asks you where you
want to store the results directory, accept the default name and click OK.
After a few moments, VuGen begins running the script. When the script
stops running, you can view a summary of the replay in the wizard.
3 Click Verify Replay in the Tasks pane to view the Last Replay Summary.
HP LoadRunner Quick Start
11
The Last Replay Summary lists any errors that may have been detected and
displays thumbnails of the Recording and Replay snapshots. You can
compare snapshots and look for discrepancies between your recording and
the replay.
You can emulate different kinds of user behavior using the run-time
settings. For example, you could emulate a user who responds immediately
to the server, or a user who stops and thinks before responding.
For more information about script verification and run-time settings, refer
to the HP LoadRunner Tutorial, Lesson 4, “Playing Back Your Script.”
How do I measure business processes?
In preparation for the load testing process, LoadRunner allows you to
enhance your script to make it more reflective of real life situations. For
example, you can insert a step in your script called a content check to verify
that certain content appears on a returned page. You can modify your script
to emulate multiple user behavior or you can instruct VuGen to measure a
specific business process.
Transactions - Measuring Business Processes
When preparing an application for deployment, you need to measure the
duration of specific business processes—how long it takes to log in, book a
flight, and so on. These business processes are normally made up of one or
more steps or actions within your script. In LoadRunner, you designate a
series of actions you want to measure by marking them as transactions.
LoadRunner gathers information about the time it takes to perform a
transaction and displays the results in color-coded graphs and reports. You
use this information to see if the application meets the original
requirements. In this section you will insert a transaction in your script to
measure the amount of time it takes for the user to find and confirm a flight.
To insert a transaction:
1 Open the Transaction Creation Wizard.
Ensure that the Tasks pane is displayed. (If not, click the Tasks button.)
In the Tasks pane, under Enhancements, click Transactions.
HP LoadRunner Quick Start
12
The Transaction Creation wizard opens. The Transaction Creation wizard
displays thumbnails of the different steps in your script.
Click the New Transaction button. You are now able to drag opening and
closing brackets and place them at their designated points in the script. An
opening bracket appears prompting you to insert a starting point for the
transaction.
2 Insert a start transaction and an end transaction marker.
Using your mouse, drag the opening bracket, place it before the third
thumbnail named Search Flights Button and click. The opening bracket
indicates the start of the transaction.
A closing bracket prompts you to insert an end point. Using your mouse,
place the bracket after the fifth thumbnail entitled reservations.pl_2 and
click.
3 Specify a name for the transaction.
The wizard prompts you to enter a name for the transaction. Type
find_confirm_flight and press ENTER.
HP LoadRunner Quick Start
13
You can adjust the start or end points of the transaction by dragging the
brackets to different points in the script. You can also rename the
transaction by selecting the existing name above the start transaction
bracket, clicking it, and typing a new name.
For more information about enhancing the script (Transactions,
Parameterization, and Content Checks), refer to the HP LoadRunner Tutorial,
Lesson 6, “Preparing a Script for Load Testing.”
Designing the Scenario with the Controller
Load testing means testing your application under typical working
conditions, which in our case means many travel agents reserving flights on
the same flight reservation system at the same time. Now that you have
completed the first step of creating a script, you need to set up the load test
environment.
Using the Controller, you divide your application performance testing
requirements into scenarios. A scenario defines the events that occur during
each testing session. Thus, for example, a scenario defines and controls the
number of users to emulate, the actions that they perform, and the
machines on which they run their emulations.
HP LoadRunner Quick Start
14
How do I create a scenario?
In this section, the objective is to create a scenario that emulates the
behavior of ten travel agents simultaneously logging on, searching flights,
purchasing flights, checking itineraries, and logging off the system.
1 Open the Controller.
Select Start > Programs > HP LoadRunner > LoadRunner. The
HP LoadRunner 11.00 window opens.
In the LoadRunner Launcher pane, click Run Load Tests. The LoadRunner
Controller opens. By default, the Controller opens with the New Scenario
dialog box.
2 Select a scenario type.
The Controller allows you to select a variety of different scenario types such
as a Goal-Oriented Scenario. For more information about these scenario
types, refer to the HP LoadRunner Tutorial, Lessons 7 and 9.
Select Manual Scenario, and click OK.
HP LoadRunner Quick Start
15
3 Add a script to the load test.
For the purpose of this Quick Start, a script is provided that is similar to the
one you created for a Web (HTTP/HTML) Vuser. We recommend that you
use the sample script.
Click Browse, and navigate to basic_script in the
\tutorial directory. The script is displayed in the
Available Scripts box and in the Scripts in Scenario box.
Click OK. The LoadRunner Controller opens your scenario in the Design
tab.
The Controller Window at a Glance
The Controller window’s Design tab contains three primary sections: the
Scenario Schedule, the Scenario Groups, and the Service Level Agreement:
Scenario
Groups pane
(Manual
Scenario)
SLA pane
Scenario
Schedule pane
(Manual
Scenario)
HP LoadRunner Quick Start
16
➤ Scenario Groups pane. You configure the Vuser groups in the Scenario
Groups section. You create different groups to represent typical users of your
system. You define the actions that they will run, the number of Vusers that
will run, and the machine on which they will run.
➤ Scenario Schedule pane. In the Scenario Schedule section, you set the load
behavior to accurately portray user behavior. You determine the rate at
which load is applied to the application, the load test duration, and how the
load is stopped.
➤ Service Level Agreement pane. When you design a load test scenario, you
can define goals or Service Level Agreements (SLAs) for the performance
metrics. When you run the scenario, LoadRunner gathers and stores
performance-related data. When you analyze the run, Analysis compares
this data against the SLAs and determines SLA statuses for the defined
measurements.
How do I generate a heavy load?
Load generators are the machines that create load on the application by
running Vusers. You can use a number of load generators, each hosting
many Vusers. When you run a scenario, the Controller connects to the load
generators automatically.
How do I emulate real load behavior?
Typical users do not log on and off the system at precisely the same time.
The Scenario Schedule pane of the Controller window allows you to build a
scenario schedule that gives a more accurate portrayal of typical user
behavior.
For example, after you create a manual scenario you can set the duration
time of the scenario or select to gradually run and stop the Vusers within the
scenario.
You will now change the default load settings and configure a scenario
schedule.
HP LoadRunner Quick Start
17
1 Select a schedule type and run mode.
In the Scenario Schedule pane, select Schedule by: Scenario and Run Mode:
Real-world schedule.
2 Set the schedule actions definitions.
In the Actions grid, set the following settings:
a Set up the Vuser Initialization.
Double-click Initialize in the Action grid. The Edit Action dialog box
opens displaying the Initialize action. Select Initialize all Vusers
simultaneously.
b Specify a gradual start.
Double-click Start Vusers in the Actions grid. The Edit Action dialog box
opens displaying the Start Vusers action.
In the Start X Vusers box, enter 8 Vusers and select the second option—
Start 2 Vusers every 30 seconds.
HP LoadRunner Quick Start
18
c Schedule the duration.
Double-click Duration in the Actions grid. The Edit Action dialog box
opens displaying the Duration action. Make sure that it is set to run for
10 minutes.
d Schedule a gradual closure.
Double-click Stop Vusers in the Scenario Schedule. The Edit Action
dialog box opens displaying the Stop Vusers action. Select the second
option—Stop 2 Vusers every 30 seconds.
3 View a graphical representation of the scheduler.
The Interactive Schedule graph shows the Start Vusers, Duration, and Stop
Vusers actions for the scenario schedule. A feature of this graph is its
interactivity, meaning that if you click the Edit Mode button, you can
change any of the settings by dragging the lines of the graph itself.
Running the Scenario with the Controller
Now that you have designed the load test scenario, you are ready to run the
test and observe how your application performs under load. Before you start
running the test you should familiarize