Sei sulla pagina 1di 42

Creating Vusers:

DATA PARAMETERS
jaipalreddy@keylabstraining.com
+91-995-938-9467

LRWEB6.5/03

Objectives
In this lesson, you will learn:
Problems that may occur during playback
The benefits of parameterization
How to parameterize fields using VuGen
How to work with data files

The Problems

Vusers fail during playback


Results meaningless because
real-world conditions not
emulated

Vusers Input Identical Data


3rd Vuser Run

02/14/99 was
yesterday!

Order number
1234 is
already here!

Dont bother me,


the datas in the
cache!

Server

The Solution

PARAMETERIZATION

Key Terms Used in This Course

Parameterization
The practice of replacing a recorded
value in a Vuser with a placeholder
which can represent an expandable
range of values.

The Objectives of
Parameterization
Solve certain problems that may occur during
playback

date constraints
unique constraints
data caching
data dependency

Emulate real user activity


Exercise the server

How Parameterization Works


Hard-coded

(same value is input every time)

Place order for item # A5455

Parameterized

(quantity

P
B0033
iteration 1
L

A0544
iteration 2
A

C
C3401
iteration 3
Place order for item #

E
A5455
H
O
Z1120
L
G9993
D
E
C8488
R

iteration 4
(quantity
iteration 5
iteration 6
iteration 7

2 ) with credit card 421234993234564

P4
L
A1
C
11
E
H2
O
210
L
D5
E
69
R

P
409485726280349
L

400320230230239
A

C
447475385798345
E

) with credit card 421234993234564


H

O
L
D
412353648765410
E
423847495782716
R

432165498765421

LoadRunner Expert Workflow


Zooming In
Phase 1

Phase 2

Plan Load
Test

Create Web
Virtual Users

Phase 3
Create
Scenarios

Phase 4
Run
Scenarios

PLAN LOAD TEST


1.1

Get system usage information

1.2

Document business process properties

1.3

Determine which fields to parameterize

1.4

Establish which data to use

Phase 5
Analyze
System
Under Load

Tune
System Based
on Analysis

1.3 Determine Which Fields to


Parameterize

Which fields require a current date?


Which fields require unique values?
Which fields exercise the database server?
Which fields values are dependent for validity
on the value of another field?

PROBLEM

Date Constraint Violation


February
1 2 3 4 5
6 7 8 9 10 11

O.K.

12 13 14 15 16 17
18 19 20 21 22 23

Order date
02/02/99

Order date
02/02/99

24 25 26 27 28
February
1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17

Expired
Date

Order date
02/02/99

Order date
02/02/99

18 19 20 21 22 23
24 25 26 27 28

Database
server

Web
server

Web browser
(client)

SOLUTION

Parameterize the Date


February
1 2 3 4 5
6 7 8 9 10 11
12 13 14 15 16 17

O.K.

18 19 20 21 22 23

Order date
02/02/99

Order date
02/02/99

24 25 26 27 28
February
1 2 3 4 5
6 7 8 9 10 11

O.K.

12 13 14 15 16 17

Order date
02/15/99

Order date
02/15/99

18 19 20 21 22 23
24 25 26 27 28

Database
server

Web
server

Web browser
(client)

PROBLEM

Unique Constraint Violation


recorded order number

1st
run

Unique
constraint
violation

Database
server

Book order
#00115

Web
server

Book order
#00115

Web browser
(client)

SOLUTION

Parameterize Order Number


1st
run

O.K.

Book order
#00975

Book order
#00975

2nd
run

O.K.

Book order
#00233

Book order
#00233

Database
server

Web
server

Web browser
(client)

PROBLEM

Reusing Data Doesnt Exercise


the System
1st
run

5 matches
found

Find book title


The Sun Also
Rises

Find book title


The Sun Also
Rises

2nd
run

Server not
exercised

5 matches
found

Find book title


The Sun Also
Rises

1. THE SUN ALSO


RISES 2. THE SUN
ALSO RISES 3. THE
SUN ALSO RISES 4.
THE SUN ALSO RISES

Database
server

Cache

Web
server

Web browser
(client)

SOLUTION

Parameterized Data Exercises


the System
1st
run

5 matches
found

Find book title


The Sun Also
Rises

Find book title


The Sun Also
Rises

2nd
run

9 matches
found

Find book title


The Great
Gatsby

Find book title


The Great
Gatsby

Database
server

Web
server

Web browser
(client)

PROBLEM

Data Dependent Fields


1st
run

2nd
run

45 matches
found

Find author
Shakespeare

Find author
Shakespeare

OK

Display MacBeth

Display match
MacBeth

19 matches
found

Find author Dickens

Find author
Dickens

MacBeth not
found

Display MacBeth

Display match
MacBeth

Database
server

Web
server

Web browser
(client)

SOLUTION

Parameterize Data Dependent Fields


1st
run

2nd
run

45 matches
found

Find author
Shakespeare

Find author
Shakespeare

OK

Display MacBeth

Display match
MacBeth

19 matches
found

Find author Dickens

Find author
Dickens

OK

Display Oliver Twist

Display match
Oliver Twist

Database
server

Web
server

Web browser
(client)

Parameterization Decision-Maker
For each field, ask . . .

Is there a
unique
constraint?

Do not
parameterize
No

Is there a
date
constraint?

No

Does
data get
cached?

Yes
Yes

No
No

Is this a
data
dependent
field?

Yes
Yes

Parameterize

Parameterize

Parameterize

Parameterize

Example for Discussion

Unique
constraint?

Date
constraint?

Data
dependent
field?

LoadRunner Expert Workflow


Zooming In
Phase 1

Phase 2

Plan Load
Test

Create Web
Virtual Users

Phase 3
Create
Scenarios

Phase 4
Run
Scenarios

PLAN LOAD TEST


1.1

Get system usage information

1.2

Document business process properties

1.3

Determine which fields to parameterize

1.4

Establish which data to use

Phase 5
Analyze
System
Under Load

Tune
System Based
on Analysis

1.4 Establish Which Data to Use


Obtain master data
extract from database

Create valid transactional data


predict according to type of data
obtain from functional expert

10/2
04046/1999
Mon 98
True day
Smi
$230th, Wm
.
.59

Extract Values From Database

48449
100345
C044
12/12/99

Willamette
48449
169.00

33339
47555
23564
12221
00410
84444

Database
server

LoadRunner Expert Workflow


Zooming In
Phase 1
Plan Load
Test

Phase 2
Create Web
Virtual Users

Phase 3
Create
Scenarios

Phase 4
Run
Scenarios

CREATE WEB VIRTUAL USERS


2.1 Record user actions(Correlate
script)
2.2 Add LoadRunner transactions
2.3 Parameterize data
2.4 Add verification checks(Check
points)

Phase 5
Analyze
System
Under Load

Tune
System Based
on Analysis

Key Terms Used in This Course

Parameter
A placeholder which replaces a hardcoded, recorded value in the script.
The parameter is replaced with a
dynamic data value at run time.

2.3 Parameterize Data

Open the Step Properties


1. Identify field to parameterize (Planning Specification)
2. Right-click step which contains the field

3. Select Properties

VUSER DESIGN SPECIFICATION


Field

Data

mtoys

search_button

query

radish
beet
carrot
rhubarb
onion

2.3 Parameterize Data

Create a Parameter
1. Click Parameter button next to the recorded value
2. Enter a parameter name (or select from the list)
3. Confirm that
parameter type
is "File"
VUSER DESIGN SPECIFICATION
Field

Data

mtoys

search_button

query

radish
beet
carrot
rhubarb
onion

2.3 Parameterize Data

Open the Parameter Properties


1. Click the Properties button
2. Click the Create button and confirm new file creation

2.3 Parameterize Data

Open the Data File


<parameter>.dat
file is added to
Vuser directory
<Vuser>

<param>.dat

Parameter
data file

Click the Edit


button to open
the data file in
Windows
Notepad

FILE NAME

2.3 Parameterize Data

Add Data to the File


Enter new data in the Notepad window
Press Enter after typing each data item
(including the last item)
Close Notepad and
save the changes
PARAMETER
VUSER DESIGN SPECIFICATION
Field

Data

mtoys

search_button

query

radish
beet
carrot
rhubarb
onion

NAME

DATA

2.3 Parameterize Data

File Data Appears in Parameter


Properties
In the Parameter
Properties dialog,
data from the file
appears in table form
Multiple columns for
different parameters
are allowed in the
same data file

Select the Data Access Method

Sequential
Random
Unique
Same line as . . .

Data File Replacement Methods


Sequential
Vuser
Iteration

1
2
3
4

Random

Unique

Vuser 1

Vuser 2

Vuser 3

Vuser 4

a
a
b
c
c
d
d
h

a
f
b
e
c
j
d
g

a
l
b
m
c
k
d
n

a
i
b
c
c
e
d
b

a
b
c
d

e
f
g
h

i
j
k
l

m
n
param1

o
p

LoadRunner Expert Workflow


Zooming In
Phase 1
Plan Load
Test

Phase 2
Create Web
Virtual Users

Phase 3
Create
Scenarios

Phase 4
Run
Scenarios

CREATE WEB VIRTUAL USERS


2.1 Record user actions
2.2 Add LoadRunner transactions
2.3 Parameterize data
2.4 Add verification checks
2.5 Verify correct execution

Phase 5
Analyze
System
Under Load

Tune
System Based
on Analysis

2.5 Verify Correct Execution

Run-Time Settings Iterations


For the Sequential access method, Iteration Count
should equal the number of rows in the data file

2.5 Verify Correct Execution

Run-Time Settings Log


Select Extended log, and check Parameter
substitution

2.5 Verify Correct


Execution

Execution
Log
Log RunTime
Settings
cause
parameter
data to
display in
Execution
Log

2.5 Verify Correct Execution

Mercury Test Results Window

Parameter
data is
also
displayed
on the
Iteration
Summary
page

2.5 Verify Correct Execution

Mercury Test Results Window


PAGE RETURNED FOR A SUBMIT FORM STEP

Sometimes, parameter data may be displayed on


the result page for the step that used the data

Summary
Parameterize fields in order to:

solve unique data constraints


solve date constraints
exercise the server(s)
handle data dependency

Establish input data:


from the database
with the help of a Functional Expert

Control Vuser execution from the Run-Time Settings


extended log, parameter substitution
number of iterations

Lab Exercise

Thank you from Keylabs


Training
Email Id: Jaipalreddy@keylabstraining.com
Cell: 9959389467

Facebook : jaipal avula

keylabstraining.com

Potrebbero piacerti anche