3.Keylabs Training Parameterization

42
[email protected] m +91-995-938-9467 Creating Vusers: DATA PARAMETERS LRWEB6.5/03

description

3.Keylabs Training Parameterization

Transcript of 3.Keylabs Training Parameterization

Page 1: 3.Keylabs Training Parameterization

[email protected]+91-995-938-9467

Creating Vusers: DATA PARAMETERS

LRWEB6.5/03

Page 2: 3.Keylabs Training Parameterization

Objectives

In this lesson, you will learn:

• The benefits of parameterization

• How to parameterize fields using VuGen

• How to work with data files

• Problems that may occur during playback

Page 3: 3.Keylabs Training Parameterization

The Problems

• Vusers fail during playback

• Results meaningless because real-world conditions not emulated

Page 4: 3.Keylabs Training Parameterization

Vusers Input Identical Data

Order number 1234 is

already here!

Server

02/14/99 was yesterday!

Don’t bother me, the data’s in the

cache!

3rd Vuser Run

Page 5: 3.Keylabs Training Parameterization

The Solution

PARAMETERIZATION

Page 6: 3.Keylabs Training Parameterization

Key Terms Used in This Course

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

Parameterization

Page 7: 3.Keylabs Training Parameterization

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

Page 8: 3.Keylabs Training Parameterization

How Parameterization Works

Hard-coded (same value is input every time) Place order for item # A5455 2(quantity with credit card) 421234993234564

Place order for item # (quantity with credit card

Parameterized

)

PLACEHOLDER

PLACEHOLDER

PLACEHOLDER

447475385798345

400320230230239

409485726280349

421234993234564

423847495782716

412353648765410

432165498765421

A5455

C3401

Z1120

A0544

B0033

C8488

G9993

11

1

4

210

69

5

2

iteration 1

iteration 2

iteration 3

iteration 4

iteration 5

iteration 6

iteration 7

Page 9: 3.Keylabs Training Parameterization

LoadRunner Expert Workflow“Zooming In”

TuneSystem Based

on Analysis

Analyze System Under Load

Run Scenarios

Create Scenarios

Create Web Virtual Users

Phase 1

Plan Load Test

Phase 2 Phase 3 Phase 4 Phase 5

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

Page 10: 3.Keylabs Training Parameterization

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?

Page 11: 3.Keylabs Training Parameterization

Date Constraint Violation

Database server

Order date 02/02/99

Web browser (client)

Order date 02/02/99

Order date 02/02/99

O.K.

Order date 02/02/99

Expired Date

Web server

1 2 3 4 57 8 9 10 116

13 14 15 16 171219 20 21 22 231825 26 27 2824

February

1 2 3 4 57 8 9 10 116

13 14 15 16 171219 20 21 22 231825 26 27 2824

February

PROBLEM

Page 12: 3.Keylabs Training Parameterization

O.K.

Parameterize the Date

Database server

Order date 02/02/99

Web browser (client)

Order date 02/15/99

Order date 02/02/99

O.K.

Order date 02/15/99

Web server

1 2 3 4 57 8 9 10 11613 14 15 16 171219 20 21 22 231825 26 27 2824

February

1 2 3 4 57 8 9 10 11613 14 15 16 171219 20 21 22 231825 26 27 2824

February

SOLUTION

Page 13: 3.Keylabs Training Parameterization

Unique Constraint Violation

Database server

Web browser (client)

Book order #00115

Book order #00115

Unique constraint violation

Web server

1strun

recorded order number

PROBLEM

Page 14: 3.Keylabs Training Parameterization

Book order #00975

O.K.

Parameterize Order Number

Database server

Book order #00975

Web browser (client)

Book order #00233

O.K.

Book order #00233

Web server

1st run

2ndrun

SOLUTION

Page 15: 3.Keylabs Training Parameterization

Reusing Data Doesn’t Exercise the System

Database server

Find book title The Sun Also Rises

Web browser (client)

Find book title The Sun Also Rises

Find book title The Sun Also Rises

5 matches found

Web server

5 matches found

Server not exercised

1st run

2ndrun

1. THE SUN ALSO RISES 2. THE SUN

ALSO RISES 3. THE SUN ALSO RISES 4.

THE SUN ALSO RISES

Cache

PROBLEM

Page 16: 3.Keylabs Training Parameterization

Parameterized Data Exercises the System

Database server

Find book title The Sun Also Rises

Web browser (client)

Find book title The Great Gatsby

Find book title The Sun Also Rises

5 matches found

Web server

1st run

2ndrun

9 matches found

Find book title The Great Gatsby

SOLUTION

Page 17: 3.Keylabs Training Parameterization

Data Dependent Fields

Database server

Web browser (client)

Find authorShakespeare

45 matches found

1st run

2ndrun

Display match MacBeth

Display MacBeth

Find author Shakespeare

Find author Dickens19 matches found

Display match MacBeth

Display MacBeth

Find author Dickens

Webserver

OK

MacBeth not found

PROBLEM

Page 18: 3.Keylabs Training Parameterization

Parameterize Data Dependent Fields

Database server

Web browser (client)

Find authorShakespeare

45 matches found

1st run

2ndrun

Display match MacBeth

Display MacBeth

Find author Shakespeare

Find author Dickens19 matches found

Display match Oliver Twist

Display Oliver Twist

Find author Dickens

Webserver

OK

OK

SOLUTION

Page 19: 3.Keylabs Training Parameterization

Parameterization Decision-MakerFor each field, ask . . .

Is there a date

constraint?Does

data get cached?

Parameterize Parameterize Parameterize

Is there a unique

constraint?

Is this a data

dependent field?

Parameterize

Do not parameterize

No

Yes

No

No

No

Yes

YesYes

Page 20: 3.Keylabs Training Parameterization

Example for Discussion

Uniqueconstraint?

Dateconstraint?

Datadependent

field?

Page 21: 3.Keylabs Training Parameterization

LoadRunner Expert Workflow“Zooming In”

TuneSystem Based

on Analysis

Analyze System Under Load

Run Scenarios

Create Scenarios

Create Web Virtual Users

Phase 1

Plan Load Test

Phase 2 Phase 3 Phase 4 Phase 5

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

Page 22: 3.Keylabs Training Parameterization

10/26/1999040498MondayTrueSmith, Wm.$230.59

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

Page 23: 3.Keylabs Training Parameterization

Databaseserver

Extract Values From Database

47555

33339

48449

23564

84444

00410

12221Willamette

169.00

12/12/99C044

100345

48449

Page 24: 3.Keylabs Training Parameterization

LoadRunner Expert Workflow“Zooming In”

TuneSystem Based

on Analysis

Analyze System Under Load

Run Scenarios

Create Scenarios

Create Web Virtual Users

Phase 1

Plan Load Test

Phase 2 Phase 3 Phase 4 Phase 5

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)

2.5 Verify correct execution(Replay and verify)

Page 25: 3.Keylabs Training Parameterization

Key Terms Used in This Course

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

Parameter

Page 26: 3.Keylabs Training Parameterization

2.3 Parameterize DataOpen the Step Properties

2. Right-click step which contains the field

VUSER DESIGN SPECIFICATIONField Data

mtoys search_button

query radishbeetcarrotrhubarbonion

1. Identify field to parameterize (Planning Specification)

3. Select “Properties”

Page 27: 3.Keylabs Training Parameterization

2.3 Parameterize DataCreate a Parameter1. Click Parameter button next to the recorded value

2. Enter a parameter name (or select from the list)

VUSER DESIGN SPECIFICATIONField Data

mtoys search_button

query radishbeetcarrotrhubarbonion

3. Confirm that parameter type is "File"

Page 28: 3.Keylabs Training Parameterization

2.3 Parameterize DataOpen the Parameter Properties1. Click the Properties button2. Click the Create button and confirm new file creation

Page 29: 3.Keylabs Training Parameterization

2.3 Parameterize DataOpen the Data File

• Click the Edit button to open the data file in Windows Notepad

FILE NAME

Parameter data file

<param>.dat<Vuser>

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

Page 30: 3.Keylabs Training Parameterization

VUSER DESIGN SPECIFICATIONField Data

mtoys search_button

query radishbeetcarrotrhubarbonion

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)

DATA

PARAMETER

NAME

• Close Notepad and save the changes

Page 31: 3.Keylabs Training Parameterization

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

Page 32: 3.Keylabs Training Parameterization

Select the Data Access Method

• Sequential• Random• Unique• Same line as . . .

Page 33: 3.Keylabs Training Parameterization

1

2

3

4

VuserIteration

Vuser 1 Vuser 2 Vuser 3 Vuser 4

Data File Replacement Methods

a a a a

b b b b

c c c c

d d d d

a e i m

b f j n

c g k o

d h l p

a

c

d

h

f

e

j

g

l

m

k

n

i

c

e

b

Sequential Random

param1

Unique

Page 34: 3.Keylabs Training Parameterization

LoadRunner Expert Workflow“Zooming In”

TuneSystem Based

on Analysis

Analyze System Under Load

Run Scenarios

Create Scenarios

Create Web Virtual Users

Phase 1

Plan Load Test

Phase 2 Phase 3 Phase 4 Phase 5

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

Page 35: 3.Keylabs Training Parameterization

2.5 Verify Correct ExecutionRun-Time Settings – IterationsFor the Sequential access method, Iteration Count

should equal the number of rows in the data file

Page 36: 3.Keylabs Training Parameterization

2.5 Verify Correct ExecutionRun-Time Settings – LogSelect Extended log, and check Parameter substitution

Page 37: 3.Keylabs Training Parameterization

2.5 Verify Correct ExecutionExecution Log

Log Run-Time Settings cause parameter data to display in Execution Log

Page 38: 3.Keylabs Training Parameterization

2.5 Verify Correct ExecutionMercury Test Results Window

Parameter data is also displayed on the Iteration Summary page

Page 39: 3.Keylabs Training Parameterization

PAGE RETURNED FOR A SUBMIT FORM STEP

2.5 Verify Correct ExecutionMercury Test Results Window

Sometimes, parameter data may be displayed on the result page for the step that used the data

Page 40: 3.Keylabs Training Parameterization

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

Page 41: 3.Keylabs Training Parameterization

Lab Exercise

Page 42: 3.Keylabs Training Parameterization

keylabstraining.com

Thank you from Keylabs TrainingEmail Id: [email protected]: 9959389467Facebook : jaipal avula