3.Keylabs Training Parameterization

Post on 10-Feb-2016

228 views 0 download

Tags:

description

3.Keylabs Training Parameterization

Transcript of 3.Keylabs Training Parameterization

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

Creating Vusers: DATA PARAMETERS

LRWEB6.5/03

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

The Problems

• Vusers fail during playback

• Results meaningless because real-world conditions not emulated

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

The Solution

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

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 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

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

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?

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

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

Unique Constraint Violation

Database server

Web browser (client)

Book order #00115

Book order #00115

Unique constraint violation

Web server

1strun

recorded order number

PROBLEM

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

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

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

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

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

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

Example for Discussion

Uniqueconstraint?

Dateconstraint?

Datadependent

field?

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

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

Databaseserver

Extract Values From Database

47555

33339

48449

23564

84444

00410

12221Willamette

169.00

12/12/99C044

100345

48449

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)

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

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”

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"

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

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

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

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 . . .

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

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

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

should equal the number of rows in the data file

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

2.5 Verify Correct ExecutionExecution Log

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

2.5 Verify Correct ExecutionMercury Test Results Window

Parameter data is also displayed on the Iteration Summary page

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

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

keylabstraining.com

Thank you from Keylabs TrainingEmail Id: Jaipalreddy@keylabstraining.comCell: 9959389467Facebook : jaipal avula