Sei sulla pagina 1di 67

2009 HP Confidential 1

Performance Testing Basics of HP


LoadRunner Lesson 1 to 4
HP CONFIDENTIAL
COURSE OUTLINE
Pre-work: HP Web Tours Overview and Demo
Lesson 1: General Concepts
Performance Testing Overview
LoadRunner Overview
LoadRunner Components Overview
Lesson 2: HP LoadRunner Installation
Lesson 3: HP LoadRunner Components Overview











Lesson 4: Virtual User Generator
Introduction to Virtual User Generator
Virtual User Generator Interface
Script Recording and Playback
Script Enhancement
1. Transaction
2. Parameter
3. Correlation
4. Verification

Debugging Tools
Day 2 Wrap Up Quiz



HP CONFIDENTIAL
2009 and HP Confidential // 3
PRE-WORK: HP WEB TOURS OVERVIEW AND
DEMO
HP CONFIDENTIAL
WHAT IS HP WEB TOURS?
HP Web Tours is a Flight Reservation simulation web application used for demo of
HP testing tools such as Quality Center, Quick Test Professional and LoadRunner.

To Access:
Click Start > All Programs > LoadRunner > Samples > Web > Start Web
Server (Xitami Web Server icon will be visible in the system tray.)

Click Start > All Programs > LoadRunner > Samples > Web > HP Web Tours
Application
(or type URL = http://127.0.0.1:1080/WebTours/ in Internet Explorer)

HP CONFIDENTIAL
2009 and HP Confidential // 5
LESSON 1: GENERAL CONCEPTS
HP CONFIDENTIAL
PERFORMANCE TESTING: OVERVIEW

Performance Testing - performed to determine how fast some
aspect of a system operates under a particular workload. It can
also serve to validate and verify other quality attributes of the
system, such as scalability, reliability and resource usage.
- a subset of Performance Engineering, an emerging computer science
practice which strives to build performance into the design and architecture
of a system, prior to the onset of actual coding effort.
- OBJECTIVE: to proactively diagnose and eliminate performance problems
before releasing the system into a production environment by running
model use loads against the system.
HP CONFIDENTIAL
PERFORMANCE TESTING: OVERVIEW

Types of Performance Testing:
1. Load Testing - conducted to understand the behavior of the application under a specific
expected load.
2. Stress Testing - used to understand the upper limits of capacity within the application
landscape.
3. Endurance Testing (Soak Testing) - done to determine if the application can sustain the
continuous expected load.
4. Spike Testing - done by spiking the number of users and understanding the behavior of the
application; whether performance will suffer, the application will fail, or it will be able to
handle dramatic changes in load.
5. Configuration Testing - testing the effects of configuration changes in the application
landscape on application performance and behaviour. A common example would be
experimenting with different methods of load-balancing.
6. Isolation Testing done to isolate transactions that have performance problems
irrespective of load to find if there are any bottlenecks

HP CONFIDENTIAL
LOADRUNNER: OVERVIEW

HP LoadRunner - a performance testing solution that tests system
behavior and performance.
- exercises the enterprise infrastructure by emulating any number of
users while employing performance monitors to identify and isolate
performance problems.
- helps enterprises identify bottlenecks before releasing applications
to production, maximize the productivity of QA cycles by testing
hardware and software applications and servers, not just business
logic, and accelerates and reduces the risk of deployment by
ensuring any system level problems have been identified and
resolved before going to production.
HP CONFIDENTIAL
MANUAL TESTING IS PROBLEMATIC

HP CONFIDENTIAL
LOADRUNNER SOLUTION

Using minimal hardware
resources, LoadRunner
emulates any number of users
(hundreds or thousands) to
put the application through the
rigidity of real-life user loads.
HP CONFIDENTIAL
2009 and HP Confidential // 11
LESSON 2: HP LOADRUNNER INSTALLATION
HP CONFIDENTIAL
LICENSING OVERVIEW


The license key controls the number and type of virtual users and the type of monitors that
can be used in the Controller. LoadRunner licenses keys are installed on the Controller and
locked to the computer by a Host ID. LoadRunner generates the Host ID in the Controller and
when a license is created this Host ID value is part of the license key. This locks the license
key to a specific computer.
Five Types of LoadRunner Licenses:
1. Permanent - The permanent license never expires but only entitles the user to a single version
of the software
2. Time Limited - The license is limited by a start date and expiration date.
3. Temporary - The license is granted for a pre-defined number of days after product installation.
4. VUD-Based - The license is limited by a number of Virtual User Days (VUDs). A VUD license
enables the user to use the product an unlimited number of times within a period of 24 hours.
5. Perpetual The license has a defined number of Vusers that can be used unlimitedly forever.
The user is entitled to support, new product versions, and patches.
HP CONFIDENTIAL
LOADRUNNER FULL SETUP


The Full Setup has two options:
Typical Installation - installs: the Controller, Virtual User Generator, Virtual User
components, online documentation, script samples, Load Generator, MI Listener, support
for Remote Performance Monitor. This installation should be used for the computer that
will control the Vusers.
Custom Installation - allows a user to select the specific components to install. These
components include: the Controller, Analysis, Vuser Generator, Load Generator, MI
Listener, Monitors Over the Firewall, Online Documentation and Samples.
HP CONFIDENTIAL
2009 and HP Confidential // 14
LESSON 3: HP LOADRUNNER COMPONENTS
OVERVIEW
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW

LoadRunner comprises of four components:

1. Virtual User Generator
2. Load Generator
3. Controller
4. Analysis


HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
THE LAUNCH SCREEN

To invoke
LoadRunner Launch
Screen in Windows:
Go to All Programs >
LoadRunner
Then Click:
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
THE LAUNCH SCREEN

Invokes the
Virtual User
Generator
(VuGen)
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
VIRTUAL USER GENERATOR

VuGen is used in developing scripts
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
THE LAUNCH SCREEN

Invokes the
Controller
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
CONTROLLER

Controller is used in
executing and
monitoring tests
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
THE LAUNCH SCREEN

Invokes the
Analysis
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
ANALYSIS

Analysis is used in
evaluating the
performance of an
application
HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW

Alternatively, LoadRunner Application can be invoked in Windows by going to:
All Programs > LoadRunner > Applications

HP CONFIDENTIAL
LOADRUNNER COMPONENTS OVERVIEW:
LOAD GENERATOR
Load Generator hosts the Virtual Users that will be generating the load against the
application under test

You can tell its running by the satellite dish icon in the Windows
task bar at the lower right corner of your screen.
HP CONFIDENTIAL
2009 and HP Confidential // 25
LESSON 4: VIRTUAL USER GENERATOR
HP CONFIDENTIAL
VIRTUAL USER GENERATOR:
INTRODUCTION
The Virtual User Generator, also called VuGen, is
LoadRunner's script development tool. VuGen uses a
business process recording technology that allows
users to record a business process and VuGen
generates a performance testing script based on the
users actions.

A business process is a series
of steps that when executed
achieves a business objective
HP CONFIDENTIAL
VIRTUAL USER GENERATOR:
INTRODUCTION
The script that VuGen creates is a recording of the
communication between the client and the server

There are several different types of virtual users, all of which are
based on the application protocol that is used between the client
and the server.
Examples: HTTP/HTML, SAPGUI, Citrix, Enterprise Java
Beans
HP CONFIDENTIAL
VUGEN INTERFACE


There are three views present in VuGen:
1. Tasks (Workflow Wizard) View
2. Tree View
3. Script View
HP CONFIDENTIAL
VUGEN INTERFACE: TASKS VIEW

The Tasks view shows a
list of the tasks required
in order to create a
functional script.
HP CONFIDENTIAL
VUGEN INTERFACE: TREE VIEW

The Tree view shows a
graphical representation of
each one of the script's
steps.
HP CONFIDENTIAL
VUGEN INTERFACE: SCRIPT VIEW

The Script view shows the
actual functions that were
generated in the script.
HP CONFIDENTIAL
SCRIPT RECORDING: CREATING A NEW SCRIPT


ONE
You can create a new
script by Going to
File > New
Or clicking the following
icon on the toolbar

HP CONFIDENTIAL
SCRIPT RECORDING: CREATING A NEW SCRIPT


TWO
HP CONFIDENTIAL
SCRIPT RECORDING: CREATING A NEW SCRIPT


THREE
HP CONFIDENTIAL
SCRIPT RECORDING:
CONFIGURING THE RECORDING OPTIONS
To configure the Recording Options:
Go to Tools > Recording Options

Or click the following icon on the toolbar

HP CONFIDENTIAL
SCRIPT RECORDING:
RECORDING OPTIONS SCRIPT LEVEL

Modification of
Scripting
Language and
Scripting Options
HP CONFIDENTIAL
SCRIPT RECORDING:
RECORDING OPTIONS RECORDING LEVEL

HTML records in
browser mode
URL records in analog
mode
HP CONFIDENTIAL
SCRIPT RECORDING: RECORDING THE SCRIPT


Alternatively, you can start the
recording by
- Going to
Vuser > Start Recording
- Or clicking the following icon
on the toolbar

HP CONFIDENTIAL
SCRIPT RECORDING: RECORDING THE SCRIPT


3. Perform user steps for
recording

Please note that the increase in
the number of events signifies
that steps are being recorded
HP CONFIDENTIAL
SCRIPT PLAYBACK: CONFIGURING THE
RUN-TIME SETTINGS
To configure the Run-time Settings:
Go to Vuser > Run-time Settings

Or click the following icon on the toolbar

HP CONFIDENTIAL
SCRIPT PLAYBACK: RUN-TIME SETTINGS
RUN LOGIC LEVEL

Defines how many
times the Vuser will
repeat the Action
section in the script
HP CONFIDENTIAL
SCRIPT PLAYBACK: RUN-TIME SETTINGS
PACING LEVEL

Defines the delay
after each iteration
HP CONFIDENTIAL
SCRIPT PLAYBACK: RUN-TIME SETTINGS
LOG LEVEL

Logs information
about the
communication with
the server
HP CONFIDENTIAL
SCRIPT PLAYBACK: RUN-TIME SETTINGS
THINK TIME LEVEL

Defines the delay
after each step
HP CONFIDENTIAL
SCRIPT PLAYBACK: CONFIGURING THE
GENERAL OPTIONS
To configure the General Options:
Go to Tools > General Options

HP CONFIDENTIAL
SCRIPT PLAYBACK: RUNNING THE SCRIPT


Alternatively, you can start
replay by
- Going to
Vuser > Run
- Or clicking the following icon
on the toolbar

HP CONFIDENTIAL
SCRIPT ENHANCEMENT: TRANSACTIONS

Transactions measure the transmission and response time
between client and server.
Transactions can be added DURING and AFTER recording
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: TRANSACTIONS

How to Add Transactions?
1. During Recording:
Click on the Start/End Transaction buttons on the floating toolbar
2. After Recording:
Script View:
Manually add the functions lr_start_transaction() and lr_end_transaction() in
the LR script
Tree View:
Right-click on a script step and select either Insert After, to insert end
transaction after a step or Insert Before, to insert start transaction before a
step
Click on the Insert Start Transaction and Insert End Transaction icons
present on the Toolbar

HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS

Parameterization is the process of replacing hard-coded
values in a script with varying values defined in a placeholder.
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS

When to parameterize?
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS

Parameter Types
Internal Data generated internally in the script
Data Files holds data that a script accesses during execution
Examples of Internal Data
Date/Time
Iteration Number
Vuser ID
Unique Number


HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS

How to Add Parameters?
1. Tree View:
Right-click on a script step and editing its properties
2. Script View:
Locate the data to be parameterized in the script, highlight it, right-click
on it and choose Replace with a Parameter.


HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS

To View the Parameter Properties:
Alternatively, you can view the parameter properties by
- Going to: Vuser > Parameter List
Click the Properties button on the
Select or Create Parameter
window
- Or clicking this icon on the
toolbar
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS

Parameter List Window:
Types of Parameter
Parameter File Path
Edit Values of Parameter
Simulate Parameter
Data Assignment and
Update Methods
Add/Delete Parameters
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS

Parameter Types: Select New Row Methods:
Sequential - assigns data to a Vuser
sequentially.
Random - assigns a random value from the
data table to each Vuser at the start of the test
run.
Unique - assigns a unique sequential value to
the parameter for each Vuser.


HP CONFIDENTIAL
SCRIPT ENHANCEMENT: PARAMETERS
Update Value Methods:
Each iteration - instructs the Vuser to use
a new value for each script iteration.
Each occurrence - instructs the Vuser to
use a new value for each occurrence of the
parameter.
Once - instructs the Vuser to update the
parameter value only once during the
scenario run.
When Out of Value Update Methods:
Abort Vuser - stops the Vuser or script
when out of data.
Continue in a cyclic manner - starts from
the beginning of the parameter table when
out of data.
Continue with last value - keeps using the
last value in the parameter table when out of
data.
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: CORRELATION

Correlation - process of enhancing a VuGen script to handle dynamic data
passed between the client and the server.
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: CORRELATION
Three ways to correlate a script:
Automatic correlation after recording
Find correlations in the script by Going to: Vuser > Scan Script for Correlations
Or clicking the following icon on the toolbar
Automatic correlation during recording
VuGen can correlate dynamic data based on Predefined Rules in the
Recording Options
Manual correlation
HP CONFIDENTIAL
COMPARING VUSER SCRIPTS USING WDIFF
A useful tool in determining which values to correlate is WDiff. This utility lets you
compare recorded scripts and results to determine which values need to be correlated.
To use WDiff effectively, you record the identical operation twice, and compare the
scripts. WDiff displays differences in yellow. Note that not all differences indicate a value
to correlate.

Go to Tools > Compare with Vuser.
Specify a Vuser script for comparison (other than the one in the current VuGen window) and click OK.
WDiff opens and the differences between the Vuser scripts are highlighted in yellow.
How to Invoke WDiff?
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: VERIFICATION

Verification confirms the functional integrity of an application under
concurrent users
HP CONFIDENTIAL
SCRIPT ENHANCEMENT: VERIFICATION

A text check is a search for a specified text string on a web page, which
adds a web_reg_find function to the script
Inserting text verification checks can be done during and after
recording
During:
1. Enable Generate web_reg_find functions for page titles under
Recording Options > HTTP Properties > Advanced before the start
of recording
2. Click the Insert text check icon in the floating toolbar
After: Right-click on a script step and select Insert Before, to insert a
web_reg_find function before a step

HP CONFIDENTIAL
DEBUGGING TOOLS


Four tools used in debugging:
1. Run Time Viewer
2. Replay Summary
3. Test Results
4. Replay Log
HP CONFIDENTIAL
DEBUGGING TOOLS: RUN-TIME VIEWER

Run-Time Viewer enables the user to watch the replay of actions
done on the Web application while debugging the script.
HP CONFIDENTIAL
DEBUGGING TOOLS: REPLAY SUMMARY

Replay Summary displays the result of the script execution
HP CONFIDENTIAL
DEBUGGING TOOLS: TEST RESULTS

Test Results window shows the overall results and detailed level
report on each step
HP CONFIDENTIAL
DEBUGGING TOOLS: REPLAY LOG

Replay Log displays messages that describe the actions of the
script as it executes
HP CONFIDENTIAL
2009 and HP Confidential // 67

END OF DAY 2
PREPARE FOR A QUIZ

Potrebbero piacerti anche