Lr7web Book 04a

610
LoadRunner for the Web 7.0 Student Workbook

Transcript of Lr7web Book 04a

Page 1: Lr7web Book 04a

LoadRunner for the Web 7.0

Student Workbook

Page 2: Lr7web Book 04a

LoadRunner for the Web 7.0

© Copyright 1994 - 2001 by Mercury Interactive Corporation

All rights reserved. All text and figures included in this publication are the exclusive property of Mercury Interactive Corporation, and may not be copied, reproduced, or used in any way without the express permission in writing of Mercury Interactive. Information in this document is subject to change without notice and does not represent a commitment on the part of Mercury Interactive.

Mercury Interactive may have patents or pending patent applications covering subject matter in this document. The furnishing of this document does not give you any license to these patents except as expressly provided in any written license agreement from Mercury Interactive.

LoadRunner, TestDirector, TestSuite, WebTest, WinRunner, and XRunner are registered trademarks of Mercury Interactive Corporation in the United States of America and/or other countries. Action Tracker, Astra LoadTest, Astra QuickTest, Astra SiteManager, Astra SiteTest, Change Viewer, Dynamic Scan, Fast Scan, Link Doctor, QuickTest, RapidTest, Topaz, Topaz Prism, Visual Testing, and Visual Web Display, are trademarks of Mercury Interactiv in the United States of America and/or other countries.

This document also contains Registered Trademarks, Trademarks and Service Marks that are owned by their respective companies or organizations. Mercury Interactive Corporation disclaims any responsibility for specifying which marks are owned by which companies or organizations.

If you have any comments or suggestions about this document, please send them via e-mail to:Training [email protected]

Mercury Interactive Corporation1325 Borregas Avenue Sunnyvale, CA 94089 Tel. (408)822-5200 (800) TEST-911Fax. (408)822-5300

LR7WEB-04

Page 3: Lr7web Book 04a

OVERVIEW

This course covers issues of load test-ing and functional testing under load for intranet and Internet client/server sys-tems. This course focuses on the impor-tance of emulating real users and teaches students to use LoadRunner tools to:

■ create Web Virtual Users (Vusers)

■ run load test scenarios

■ analyze and interpret load test results

Page 4: Lr7web Book 04a

COURSE OUTLINE for LOADRUNNER for the WEB 7.0

Duration: Four days

Labs: Approximately 50% of the class is devoted to lab exercises

Intended Audience: Quality assurance engineers, performance engineers, technical managers, and others who may be required to perform load analysis on Web systems

Prerequisites: Knowledge of the Windows 2000 or NT interface and environmentHigh-level knowledge of the Web client/server paradigm

Course Outline:Planning an Effective Load Test

The importance of planningObtaining, organizing and analyzing system usage informationDetermining fields to parameterize and the data to use

Creating and Enhancing Web Virtual Users (Vusers)Recording user actionsMeasuring specific business processesVerifying functionality under loadParameterizing input data

LoadRunner ScenariosDefining scenario goals based on planningDefining and connecting to load generatorsSelecting and configuring performance monitorsOptions and run-time settings for specific purposesTroubleshooting errors

Analyzing Scenario ExecutionFinding bottlenecks in a systemDrilling down in graphs Merging graphsCreating cross result graphs

Advanced TopicsHow VuGen records and replays user actionsCorrelating (capturing and reusing) dynamic values manually Correlating automatically during and after recordingAdding code and logic to the VuserMaking output logs more informativeEmulating different IP addresses during load testing

Page 5: Lr7web Book 04a

v

Table of Contents

Introduction ............................................................................................ ix

Part 1: Creating Web Virtual Users

1 Planning an Effective Load Test ..........................................................1-1

Exercises ....................................................................................... 1-19

2 Recording .............................................................................................2-1

Exercises ....................................................................................... 2-47

3 LoadRunner Transactions ....................................................................3-1

Exercises ....................................................................................... 3-23

4 Verification Checkpoints .......................................................................4-1

Exercises ....................................................................................... 4-39

5 Data Parameterization .........................................................................5-1

Exercises ....................................................................................... 5-45

Part 2: Web Scenarios & Analysis

6 Manual Scenarios ................................................................................6-1

Exercises ....................................................................................... 6-55

7 Goal-Oriented Scenarios ......................................................................7-1

Exercises ....................................................................................... 7-39

Page 6: Lr7web Book 04a

vi

Part 3: Data Correlation

8 Manual Correlation ...............................................................................8-1

Exercises....................................................................................... 8-49

9 Automatic Correlation After Recording ................................................9-1

Exercises....................................................................................... 9-19

10 Automatic Correlation During Recording ...........................................10-1

Part 4: Advanced Topics

11 Custom Output Messages .................................................................11-1

Exercises..................................................................................... 11-33

12 Understanding Record and Playback ................................................12-1

13 IP Spoofing ........................................................................................13-1

A Appendix: Answers to Questions ........................................................ A-1

B Appendix: Test Specifications ............................................................. B-1

C Appendix: Scaling the Web ................................................................. C-1

Page 7: Lr7web Book 04a

vii

Typographical Conventions■ Actual items to type are written in courier font.

■ An arrow (>) is used to indicate cascading menus. (File > Open)

■ Any italic text between brackets should be replaced with the appro-priate information. (<Number of Items>)

■ Italic text without brackets are used to indicate buttons, check boxes, etc. (Press the Next button.)

■ List items appear in quotation marks. (Select “Carol”)

■ NOTES contain information that you need to know to do the lab exercises successfully.

■ TIPS provide alternate ways of performing actions or time-saving techniques but are not essential knowledge for the lab exercises.

Page 8: Lr7web Book 04a

viii

Page 9: Lr7web Book 04a

Introduction ix

Introduction

Page 10: Lr7web Book 04a

x LoadRunner for the Web 7.0

I

Mercury InteractiveProduct Training

LR7WEB-04

Page 11: Lr7web Book 04a

Introduction xi

I

2

������������ �������

Company Profile• Incorporated in August, 1989• IPO in October, 1993 — NASDAQ: MERQ

• S&P 500 in June, 2000• Headquarters in Silicon Valley–Offices

world wide

Page 12: Lr7web Book 04a

xii LoadRunner for the Web 7.0

I

3

������ ��������������� �

Productsand

Services

ERP CustomizationsSAPOraclePeopleSoftSiebel

WebWinRunner WebTest

LoadRunnerTestDirector

Astra QuickTestAstra LoadTest

Application PerformanceMonitoringActiveAgent

ActiveTestActiveWatch/APM

TopazPrism

C/S - DatabasesLoadRunnerTestDirectorWinRunner

Page 13: Lr7web Book 04a

Introduction xiii

I

4

����� ��������

• Documentation

• Online help

• Web Site

• Training

• Consulting

• Technical Support

• Users’ Conference

Page 14: Lr7web Book 04a

xiv LoadRunner for the Web 7.0

I

5

����� ��������

[email protected] convenience

http://support.merc-int.com/Enter specific issues directly into oursupport database

Monitor the status of your open issue

(408)822-54006 am - 5 pmPacific Standard Time

Our site helped usto earn the

• Software TechnicalAssistanceRecognition(STAR) Award

• Support CenterPracticesCertification

• WebStar ServiceAward

from the SoftwareSupportProfessionalsAssociation

Page 15: Lr7web Book 04a

Introduction xv

I

6

http://support.mercuryinteractive.comWorld Wide User Community of 23,000+Self Help Features

Mercury Interactive Knowledgebase (1000’s of solutions)Customer KnowledgebaseUser Discussion Forums (1000’s Q&A each quarter)

Submit/Update/Track Support Cases OnlinePatches & Service PacksProduct Alerts and AnnouncementsOnline DocumentationCompany PromotionsCustomer Reward Program

�����������������������

Page 16: Lr7web Book 04a

xvi LoadRunner for the Web 7.0

I

LoadRunner 7.0 for the WebIntroduction

Page 17: Lr7web Book 04a

Introduction xvii

I

8

��������������������� ���

Creating and enhancing web virtual usersfor load testing web applications

Creating and running load test scenarios,and analyzing their results

Advanced Topics

Page 18: Lr7web Book 04a

xviii LoadRunner for the Web 7.0

I

9

��!��������"����������

✔ Understand the issues involved in load testingWeb applications

✔ Learn your responsibilities as the LoadRunnerexpert

✔ Learn how to perform successful load testsusing LoadRunner tools

Page 19: Lr7web Book 04a

Introduction xix

I

10

����#�� ������$��������������� %

• The failure of a mission-critical web applicationcan be costly

• Assure performance and functionality underreal-world conditions

• Locate potential problems before yourcustomers do

Page 20: Lr7web Book 04a

xx LoadRunner for the Web 7.0

I

11

&��������'�� �� �����������

#�� �����

DEFINITION

A load test is many concurrent users runningthe same program to see whether a systemhandles the load without compromisingfunctionality or performance.

Page 21: Lr7web Book 04a

Introduction xxi

I

12

TEST TYPE OBJECTIVE

#�� ��������!������

FunctionalityUnder Load

Performance How many concurrent users can thesystem handle before response timeexceeds 15 seconds?

Can the system serve 1000 concurrentusers, or will some users get error pages?

EXAMPLE

Page 22: Lr7web Book 04a

xxii LoadRunner for the Web 7.0

I

13

(� ��� �����)�#�� ������ �

Functionaltest Do business

processes functioncorrectly afterimplementation?

Functionality

OBJECTIVETEST TYPE

Loadtest Is response time

acceptable accordingto specifications?

Performance

Do businessprocesses functionproperly under heavyload?

Functionalityunder load

OBJECTIVETEST TYPE

EXAMPLE

Page 23: Lr7web Book 04a

Introduction xxiii

I

14

��� ����#�� ������ ��*�� � %

ProductionWhat is the cause of

performance degradation?

DeploymentIs the system reliable enoughto go into production?

DevelopmentDoes the system responsetime meet requirements?

Planning and DesignWhat is the best server tosupport 1000 users?Evolution

How many users can beadded without decreasing

system performance?

Page 24: Lr7web Book 04a

xxiv LoadRunner for the Web 7.0

I

The limitations of manual testing make it difficult to achieve meaningful load test results.

15

Testers

Load Generation System Under Test

Do you have the testing resources?• Testing personnel• Client machines

How do you synchronize users?

How do you collect and analyze results?

How do you achieve test repeatability?

All of you,click the

GO buttonagain

�� ��������� �����+��������

Coordinator

Internet

Web server Databaseserver

Page 25: Lr7web Book 04a

Introduction xxv

I

LoadRunner provides you with tools that address the issues of manual testing.

16System Under Test

����#�� ,� ���������

Overcomes resource limitations

• Meaningful results with analysis tools• Repeatable tests with scripted actions

Analysis

• Runs many Vusers on few machines• Replaces testers with “Virtual Users”

• Controller manages the Vusers

Load Generation

Vusers

Internet

Web server Databaseserver

Controller

Vuserhost

Page 26: Lr7web Book 04a

xxvi LoadRunner for the Web 7.0

I

17

&��������'�� �� �����������

-������'���.-���/

DEFINITION

Vusers are central to the implementation of LoadRunner

A Vuser is a script of recorded useractions. When played back, the scriptinteracts with a Web application justlike a real user.

Page 27: Lr7web Book 04a

Introduction xxvii

I

18

����#�� ,� ���������

Provides support for many protocols and APIs

Page 28: Lr7web Book 04a

xxviii LoadRunner for the Web 7.0

I

19

����#�� ,� ���������

• Web servers

• Web applicationservers

• Firewalls

• Streaming media

• Networks

• Database servers

• System resources

Provides monitors for many servers and resources

Page 29: Lr7web Book 04a

Introduction xxix

I

These are the LoadRunner tools you will work with to implement load testing for the Web.

20

����#�� ,� ���������

Virtual User Generator

Creates and runs scenarios;manages Vusers, machines,and monitors

Creates the Vusers whichload the system under test

Displays test results usinggraphical and statistical tools

LoadRunner Controller

LoadRunner Analysis

Page 30: Lr7web Book 04a

xxx LoadRunner for the Web 7.0

I

■ Planning - Gather and document all relevant information about the system for the load test.

■ Create Web Vusers - Use the Virtual User Generator (VuGen) to automate user actions of the selected business processes that you will test.

■ Create Scenarios - Use LoadRunner’s Controller to set up the load test environment by putting together the hardware, the Virtual Users (Vusers) and the conditions under which the load test will be run.

■ Run Scenarios & Analyze Results - Run the load test and compile the results for analysis using LoadRunner’s Controller. Use the analysis tools to organize and display the results.

■ Tune the System - Analysis of results should reveal areas of the system that require adjustment. Repeat the load test to confirm that system adjustments had the desired effect.

21

TuneSystem Based

on Analysis

#�� ,� ��01������2"���3����4���+����5

AnalyzeSystem

Under Load

Phase 5

LoadRunnerV U G E N

LoadRunnerC O N T R O L L E R &

A N A L Y S I S

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

NOTE: This is the process for a LoadRunner expert. In this course somesteps may be presented in a different order to facilitate the learning process.

Page 31: Lr7web Book 04a

Introduction xxxi

I

Load testing should be done after all functional testing is completed.

As the LoadRunner Expert, you must work with your teammates to achieve successful load test results.

22

#�� ������ ������������0""��

Team Member Main Responsibility

Provides expertise on the businessfunctionality of the Web site

DatabasePerformance BasisExpert

Analyzes and tunes the database server

LoadRunner Expert

Web ServerPerformance BasisExpert

Project Manager

Functional Expert

Analyzes and tunes the Web server

Manages the Web site implementation

Creates the multi-user load on the system

Page 32: Lr7web Book 04a

xxxii LoadRunner for the Web 7.0

I

The LoadRunner Expert’s tasks and responsibilities extend to five phases of the load testing process. Remember that successful load testing is a team effort, and you need to rely on each of your teammates’ expertise to succeed.

23

#�� ,� �������,���� ����������

LR Expert

FunctionalExpert

ProjectManager

LR Expert

FunctionalExpert

ProjectManager

LR Expert LR Expert

Sys Admin

ServerExpert(s)

TuneSystem Based

on Analysis

Analyze System Under Load

Phase 5

Run Scenarios

Phase 4

Create Scenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

Sys Admin

ServerExpert(s)

LR Expert

Page 33: Lr7web Book 04a

Part 1: Creating Web Virtual Users

Page 34: Lr7web Book 04a
Page 35: Lr7web Book 04a

Planning an Effective Load Test 1-1

Planning an Effective Load Test

Page 36: Lr7web Book 04a

1-2 LoadRunner for the Web 7.0

1

2

��!������

In this lesson, you will learn:

• What preliminary information to gather before loadtesting your system

• Where useful information about your systemmight be obtained

• Effective techniques for organizing systeminformation

• How to use system information to plan load tests

Page 37: Lr7web Book 04a

Planning an Effective Load Test 1-3

1

3

&��������'�� �� �����������

4��� ����+����

DEFINITION

A business process is a set of user actionsperformed with an application to accomplisha business task.

Examples: • Login to a Web site• Look up flight information• Buy a book

Page 38: Lr7web Book 04a

1-4 LoadRunner for the Web 7.0

1

4

�������������#��� �+����

EXAMPLE

1. Start recording with VuGen2. Manually log in to the Web site3. Stop recording4. Play back the recording to

make sure it works the wayyou want it to

2. Type a valid user ID

3. Type a valid password

USER ACTIONS

4. Click the Login button

1. Open the Login page

5. Check that the sitedisplays the Welcome page

Automate the login process toensure that it functions correctlyunder a heavy load

Page 39: Lr7web Book 04a

Planning an Effective Load Test 1-5

1

5

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

1.1 Get system usage information

1.2 Decide which business processes to test

1.3 Document business process properties

1.4 Determine which fields to parameterize

1.5 Establish which data to use

Page 40: Lr7web Book 04a

1-6 LoadRunner for the Web 7.0

1

Note: The diagrams and profiles mentioned on this and subsequent slides must be created by the tester. LoadRunner provides no tools to create them. These are intended as examples only. The tester may find other ways to organize information that are more useful.

6

7)7������������'������ "������

Purpose:• Decide which business processes to automate• Prioritize business processes to be automated• Provide information for building load tests

Useful formats for displaying system usageinformation:

• Task Distribution Diagram• Transaction Mix• User Profile

Page 41: Lr7web Book 04a

Planning an Effective Load Test 1-7

1

7

�������������������� "������

• Experienced users

• System Administrators

• IT Managers

• IT documentation

• Online statistics

• Web developers

• Webmasters

Page 42: Lr7web Book 04a

1-8 LoadRunner for the Web 7.0

1

8

'��"�������������� ����������� "������

• Task Distribution Diagram– which business tasks?– how many operations at what times of the day?

• Transaction Mix– how many operations on average, how many at peaks?– how much database activity?– how much risk to business if task fails?

• User Profile– which tasks does each real user perform?– what is ratio of different tasks for each user?

NOTE: The diagrams and profiles in the followingillustrations must be created by the user.

Page 43: Lr7web Book 04a

Planning an Effective Load Test 1-9

1

The task distribution diagram displays the throughput of all business pro-cesses relative to the timeline of a working day. By displaying the informa-tion in this format, you can isolate peak times of usage.

9

1.1 GET SYSTEM USAGE INFORMATION

���2�8��������� �8������.7/

ONLINE BOOKSTORE (typical day, hundreds of users)

View shopping cart

AdministrativeProcesses

*Invoiceprocessing

*System backup

BusinessProcesses

Search for title

Purchase book

Create new account Night Day Night

1 1

50 50 50 50

180 210 150 130 100

150 200 170 140

1000 1200 600

40 30 40 75

12 122 24 46 68 810 10 12am pm

Hours to beemulated

*Not a Web task

EXAMPLE

Page 44: Lr7web Book 04a

1-10 LoadRunner for the Web 7.0

1

There may be more than one peak load time depending upon seasonal, accounting or other factors.

As a recommendation, you should start load testing by emulating a nor-mal day’s throughput. You should then proceed to test the peak times (or a sample of the peak times depending on your testing time schedule).

10

ORDER PROCESSING INTRANET (peak day, 600 users)

1.1 GET SYSTEM USAGE INFORMATION

���2�8��������� �8������.9/

*Not a Web task

Night Day Night

11 14

180 210 220 180 170

40 40 30

220 250 210

10 1215

90 90 70

20 25 16

4060

10

12

50

30

50

12 122 24 46 68 810 10 12am pm

*System backup

Create order

Update order

Log in

Create newuser account

Ship order

*Billing batch

*Delivery batch

TASK

Hour to beemulated

EXAMPLE

Page 45: Lr7web Book 04a

Planning an Effective Load Test 1-11

1

The Transaction mix displays system usage information in terms of the Web system, rather than of the users. Besides transactions, throughput and peak load times, the information can be expanded to include such things as:

■ Web server activity

■ DB interaction

■ Legacy system interaction

■ Level of risk if the transaction should malfunction

You might have to rely on Functional Experts, Project Managers and End Users to gather the information shown in this diagram. Usually, the users are interviewed about what business processes they perform and how often they perform them.

11

DECIDE WHICH BUSINESS PROCESSES TO TEST

�� ����� ���1Which business process to automate?

RiskBusinessprocess name

Ship order

Typical day

20/hr

Peak day

30/hr

Web server activity

Moderate

Moderate

Moderate High

40/hr 90/hr Heavy High

Databaseactivity

Create order

Update order

Create newaccount

130/hr 180/hr Moderate Moderate Mod.

10/hr 15/hr Moderate Moderate Low

Log in 70/hr

✓ ✓

210/hr Heavy Light High

Selectioncriteria: High in database I/O✓

High throughput✓

High business risk✓

EXAMPLE

Page 46: Lr7web Book 04a

1-12 LoadRunner for the Web 7.0

1

12

1.1 GET SYSTEM USAGE INFORMATION

'���+�"���

• Who are the users?• How many are there?

• What tasks do the users perform?• How often do users do their tasks?

ReservationAgent (170)

Freq. FlyerAgent (50)

Manager (30)

1- Enter Orders

3 - Calc. F.F. Miles

4 - Calc. Sales

2 - Update Orders

100

50

70

8

B.P.Users

25

10

5

EXAMPLE

BusinessProcess

Task frequency (throughput per hour)

Type andnumberof users

Page 47: Lr7web Book 04a

Planning an Effective Load Test 1-13

1

13

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

1.1 Get system usage information

1.2 Decide which business processes to test

1.3 Document business process properties

1.4 Determine which fields to parameterize

1.5 Establish which data to use

Page 48: Lr7web Book 04a

1-14 LoadRunner for the Web 7.0

1

14

DECIDE WHICH BUSINESS PROCESS TO TEST

�������'�������� "������

Some criteria for decision making:

• Which processes have the highest business risk("mission critical")?

• Which processes are most frequently used?

• What are the peak load times?– peak hours of the day– peak days of the month, quarter, or year

• Which processes are linked (data dependent)?

• Which processes are resource intensive?

Page 49: Lr7web Book 04a

Planning an Effective Load Test 1-15

1

You, as the LoadRunner Expert, might not know how to complete a partic-ular business process (e.g., what data to use). By getting all of the process properties (information) from the Functional Expert or any other real user, creating Vusers becomes a much simpler task.

15

7):�8���� ��4��� ����+����+�������

The purpose is to obtain information necessaryto create Virtual Users (Vusers), such as:

• User actions• Expected results of each action• Input data fields• Valid data for input

Page 50: Lr7web Book 04a

1-16 LoadRunner for the Web 7.0

1

16

USERACTIONS

INPUTDATA

EXPECTEDRESULT

8���� ��4��� ����+����+�������

Type validuser id

Type validpassword

Welcomepage appears

Existing userIDs

Correspondingpasswords

Click Loginbutton

EXAMPLE

Page 51: Lr7web Book 04a

Planning an Effective Load Test 1-17

1

17

������

• Gather and organize system usage information

• Use the selection criteria when deciding whichbusiness processes to test

• Document business processes properties– user actions– expected result– valid data

Page 52: Lr7web Book 04a

1-18 LoadRunner for the Web 7.0

1

Page 53: Lr7web Book 04a

Planning an Effective Load Test 1-19

1

Exercises

Overview

Your company, Mercury Tours, is a medium-sized travel and tours company. As part of its campaign to increase sales, Mercury Tours plans to expand its travel and tours business into e-commerce. An external Web site has been built to serve its customers via the Internet.

The system has been built, customized and configured. It is stable. Everything works for one user. Now load testing can begin.

As the LoadRunner Expert, it is your responsibility to use LoadRunner’s VuGen and Controller to create the required load on the system. In addition to creating the required load, you will also use LoadRunner’s analysis tools to assess the results.

In the following pages, we will present information about the system to be load tested in the form of a Planning Specification. The Planning Spec. is intended to represent the sort of documentation you would have to put together yourself if it were a real life situation. After each lesson, a portion of the Planning Spec. will be followed by some exercises. You will need the information contained in the Plan-ning Spec. to do the exercises.

Page 54: Lr7web Book 04a

1-20 LoadRunner for the Web 7.0

Planning Specification

Flight Application Web Site Usage

6 am 9 am3am 12pm 3 pm 6pm 9pm

system backup

TOTAL

Source: Mercury Tours MIS Dept.

12

TASK DISTRIBUTION FOR NORMAL BUSINESS DAY

search for flights13 15 30 17 25 22 17

display itinerary12 16 15 30 19

delete reservation11 12 11

book a flight16 18 14 18 30 19

11 12 15 11 11register new user account

13 23 31 76 46 29 112 82 28

Page 55: Lr7web Book 04a

Planning an Effective Load Test 1-21

6 am 9 am3am 12pm 3 pm 6pm 9pm

system backup

TOTAL

Source: Mercury Tours MIS Dept.

12

TASK DISTRIBUTION FOR PRE-HOLIDAY TRAVEL

search for flights

display itinerary

delete reservation

book a flight

register new user account

24 20 50 40 30 70 70 50

30 30 20 50 36 24

4 2 8 2

16 30 24 40 36 24

4 30 20 40 16 20

24 70 144 40 96 208 158 120

Page 56: Lr7web Book 04a

1-22 LoadRunner for the Web 7.0

Transaction Mix

Transac-tion Name

Normal Day Peak Thruput

Pre-Holiday Peak Thruput

System Usage DB Usage Risk

Search for flight

25 70 transaction processed from the client side, generates server activity

heavy low

Display itinerary

30 50 transaction processed from the client side, query for existing flight reserva-tions generates server activity

heavy med

Book a flight

30 40 generates activity in the database server, returns server output to con-firm transaction completion

heavy high

Delete flight res-ervation

12 8 generates activity in the database server, returns server output to con-firm transaction completion

low low

Create new user account

15 40 adds new member to the customer database, user may proceed to mem-ber login

low high

Page 57: Lr7web Book 04a

Planning an Effective Load Test 1-23

Selected Business Transactions to AutomateMercury Tours has determined the three key business transactions for load test-ing.

BUSINESS TRANSACTION NORMAL LOAD PEAK LOAD

Display Itinerary 30 50

Book a Flight 30 40

Create New User Account

15 40

Page 58: Lr7web Book 04a

1-24 LoadRunner for the Web 7.0

1

Review Questions

Refer to the information presented in the Planning Specification to answer the fol-lowing questions.

1. What are some of the ways you could have obtained the information shown in the Task Distribution Diagrams?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. How does the information in a Task Distribution Diagram help you to build a Transaction Mix?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

3. What information is gathered in the Transaction Mix that is not displayed in the Task Distribution Diagram?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

4. Where would you get the additional information (not in the Task Distribution Diagram) which appears in the Transaction Mix?

________________________________________________________________________

________________________________________________________________________

Page 59: Lr7web Book 04a

Planning an Effective Load Test 1-25

1

5. What criteria would you use to select Web transactions for load testing?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 60: Lr7web Book 04a

1-26 LoadRunner for the Web 7.0

1

Page 61: Lr7web Book 04a

Recording 2-1

Recording

Page 62: Lr7web Book 04a

2-2 LoadRunner for the Web 7.0

2

2

��!������

• How to structure a Vuser based on planning

• How to create a Vuser script by recording useractions with the Virtual User Generator (VuGen)

• How to play back the Vuser and review the runresults

In this lesson you will learn:

Page 63: Lr7web Book 04a

Recording 2-3

2

3

������-����

• Different types available (partial list)– E-Business– Wireless– ERP– Client/Server– RTE

• This course deals only with Web Vusers

Page 64: Lr7web Book 04a

2-4 LoadRunner for the Web 7.0

2

4

����� ����-��������;�������

1. Document the business process

2. Create and enhance a Vuser with VuGen2.1 record user actions2.2 insert measuring transactions2.3 insert verification checkpoints2.4 parameterize input data2.5 correlate reused data

3. Run the Vuser to verify correct execution

After testing, assign the script to a LoadRunner scenario

PROCESS

CREATE

ENHANCE

Page 65: Lr7web Book 04a

Recording 2-5

2

During recording, VuGen invokes the browser and “hooks” into the HTTP communication layer. HTTP (Hypertext Transfer Protocol) is the language that Web clients and Web servers use to communicate with each other.

By means of these communications hooks, VuGen can capture the com-munication between the browser and Web server. VuGen generates a Vuser script from this process.

More in-depth details about the recording process are discussed later in this course.

5

������-���

• Records HTTP communication between the browserand the Web server

• Uses the recording to create Virtual Users (Vusers)which can be run to emulate real users

• Provides the means to enhance recordings– verify that business processes are functioning

correctly– measure the performance of business processes

on your Web site– run each business process with many sets of data

Page 66: Lr7web Book 04a

2-6 LoadRunner for the Web 7.0

2

6

CREATE A VUSER

,�� �'������� �

VuGensend URL1receive web page

• VuGen launches the browser and taps intoits HTTP communication

• VuGen captures the HTTP communicationwhile you work in your application

• The captured communication becomes part of a Vuser script which can be played back

Webserver

BrowserWeb Application

Internet

Page 67: Lr7web Book 04a

Recording 2-7

2

7

CREATE A VUSER

0 �� ������-��������

Vuser Scriptstart transactionsend {test_url}receive web pageend transactionpage checkpoint

These topics are discussed in more detail in later lessons

• Insert measuring transactions• Insert verification checkpoints• Parameterize input data• Correlate reused data

Page 68: Lr7web Book 04a

2-8 LoadRunner for the Web 7.0

2

The server(s) that are required to handle the requests from the browser don’t know the difference between a real user and a Vuser.

8

CREATE A VUSER

,� �����-���

The running Vuserinteracts with aWeb applicationlike a real user

Webserver

Internet

Vuser Scriptstart transactionsend {test_url}receive web pageend transactionpage checkpoint

Play it backto verify that itruns correctly

Page 69: Lr7web Book 04a

Recording 2-9

2

9

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 70: Lr7web Book 04a

2-10 LoadRunner for the Web 7.0

2

10

&��������'�� �� �����������

����

DEFINITION

A recorded business process orseries of steps that, when playedback, emulates a real user performingthe same steps.

Page 71: Lr7web Book 04a

Recording 2-11

2

11

���������� �

• An Action is composed of Steps

• Each Step is– a user action, server response, or a LoadRunner

enhancement step– represented by an icon

User action step

(URL)LoadRunner

enhancementstep

(think time)

Serverresponse step

(cookie)

Page 72: Lr7web Book 04a

2-12 LoadRunner for the Web 7.0

2

12

8�"� ���� �

Business processA user interacting with an application to accomplish a business task

User actionsWhat a user does to interact with an application, e.g., type, click,react to system responses

Virtual User (Vuser)The recorded user actions that automate a business process.A Vuser may contain multiple Actions.

LoadRunner TransactionAn end-to-end measurement of one or more user actions within anaction (browser-to backend-to browser)

ActionA group of recorded steps; an organizational unit in a recordedVuser script

Page 73: Lr7web Book 04a

Recording 2-13

2

Replay information is optional. It may be toggled on and off in the Corre-lation tab of the General Options dialog.

13

-��� ��� ��

PAGE VIEW

LOG PANE

RECORD PANE

TREE VIEW

REPLAY PANE

Page 74: Lr7web Book 04a

2-14 LoadRunner for the Web 7.0

2

14

-��� ��� ���.� �� �� /

HTML VIEW

Page 75: Lr7web Book 04a

Recording 2-15

2

VuGen is the integrated development environment that allows you to record user actions, modify and play back Vusers.

15

#�� ,� ��-��� ��������-���8�������� ��0 ��� �� �

Record Toolbar

NewAction

FileStart, Pause,Stop Recording

InsertComment

InsertRendezvous

Run

SelectAction

File

RecordingOptions

Page 76: Lr7web Book 04a

2-16 LoadRunner for the Web 7.0

2

HTML or URL recording is one of the more important choices the tester must make.

16

����,�� � ������� �;,�� � �

• HTML– browser/context

sensitive– records as Web

objects– "high level"

NOTE: Move the pointer over any item tosee its description in the Hint frame

• URL– HTTP/analog

– Web objects areused as functionarguments

– "low level"

Page 77: Lr7web Book 04a

Recording 2-17

2

17

• Reduces need to capture dynamic values– action tag values and hidden data are NOT hard coded

– they are retrieved from memory during playback

– if they are dynamic, the Vuser still runs

• Script is only as big as the business process–onestep per page

4� �"�����"����#�,�� � �

Page 78: Lr7web Book 04a

2-18 LoadRunner for the Web 7.0

2

18

• Scripts are less scalable

• Memory (cache) is searched during playback– requires more memory– requires more CPU power

8��� �� �������"����#�,�� � �

Page 79: Lr7web Book 04a

Recording 2-19

2

19

• Flexibility– support for Java Applets and ActiveX objects on the page– ability to replay on Unix

• Scalability–scripts are more scalable than HTMLscripts because they require fewer resources

4� �"�����"����+�,�� � �

Page 80: Lr7web Book 04a

2-20 LoadRunner for the Web 7.0

2

20

• Scripts require more correlation (nothing isretrieved from cache)

• Context-sensitive checks won’t work (parser isdisabled)*

• Scripts are large (all images and frames arerecorded as separate steps)

8��� �� �������"����+�,�� � �

* Use web_reg_save_param to search for specific text

Page 81: Lr7web Book 04a

Recording 2-21

2

21

����,�� � ������� �;��������

Correlation is discussed in a separate lesson

Page 82: Lr7web Book 04a

2-22 LoadRunner for the Web 7.0

2

22

����,�� � ������� �;4����

These options give you more control when youstart recording

Page 83: Lr7web Book 04a

Recording 2-23

2

23

����,�� � ������� �;,�� � �+�1�

If Restore proxysettings is notchecked, yourbrowser may notwork correctlyafter you havefinished recording

Page 84: Lr7web Book 04a

2-24 LoadRunner for the Web 7.0

2

24

����,�� � ������� �;� �� �

Think time steps simulate human users by pausingbetween user actions

• Gives you realuser emulation

• You can excludethink-times fromplayback (andAnalysis) ifdesired

Check Recordthink-time

Page 85: Lr7web Book 04a

Recording 2-25

2

The logon and logoff may be recorded inside the action if you wish.

25

9)7�,�� �'������� �

1. Invoke VuGen

2. Click StartRecording

3. Enter URL ofsite under testand click OK

Page 86: Lr7web Book 04a

2-26 LoadRunner for the Web 7.0

2

26

9)7�,�� �'������� �

Perform taskwith Webapplication

FLOATINGRECORD

TOOLBAR

Page 87: Lr7web Book 04a

Recording 2-27

2

Note the events counter in the title bar of the Record toolbar. That counter should increment during recording. If it does not, you should stop record-ing and find out what the problem is.

27

9)7�,�� �'������� �

Click StopRecordingto closebrowser

Page 88: Lr7web Book 04a

2-28 LoadRunner for the Web 7.0

2

28

��� �+�����

• Know the data and page flow before recording

• During recording– add LoadRunner transactions wherever a

measurement is needed*– add verification checkpoints*

– rename steps to make them more descriptive– add comments liberally as reference points

• Save the Vuser script before running it the first time

* LoadRunner transactions and verificationcheckpoints are discussed in separate lessons

Page 89: Lr7web Book 04a

Recording 2-29

2

29

� ����,� �������.����� ��/

• Rendezvous points make faster Vusers wait forslower ones

• When released from rendezvous point, Vusers dosame action at same time

• Tester can determine at which points to applymaximum load

Page 90: Lr7web Book 04a

2-30 LoadRunner for the Web 7.0

2

30

� ����,� �������.����� ��/

Page 91: Lr7web Book 04a

Recording 2-31

2

31

������ ��� �'�����01������

URLVuser begins at this URL

or selects a bookmark

Submit Form/DataVuser sends a form or data

to the server

ImageVuser clicks on a

hyperlinked image

ServiceSet cookie

LinkVuser clicks on ahyperlinked page

Page 92: Lr7web Book 04a

2-32 LoadRunner for the Web 7.0

2

32

�����-���Script View shows "the code behind the icon tree"

Status bar shows current line number of cursor

Page 93: Lr7web Book 04a

Actions 2-33

33

,� ��� ��� �����

2. Type new name

3. Press Enter

To enhance TestTree readability:1. Click action name

Page 94: Lr7web Book 04a

2-34 LoadRunner for the Web 7.0

As you gain experience with VuGen, you will find that renaming icons is very useful. The tree becomes much more descriptive which makes Vuser maintenance much easier.

34

,� ��� ���������� ������� ����

2. Right-click the step icon

3. Select "Properties" frompop-up menu

5. Overwrite default namewith a descriptive nameand click OK

4. Click General tab ofProperties dialog

1. Select a step to rename

To enhance Test Treereadability:

Page 95: Lr7web Book 04a

Recording 2-35

2

35

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 96: Lr7web Book 04a

2-36 LoadRunner for the Web 7.0

2

The Run-Time Viewer displays only the Web pages received from the server, not the pages sent to the server.

■ Show browser during replay is checked by default.

■ The reporting options are checked by default.

■ Prompt for result directory is unchecked by default.

■ Save correlation information during replay is checked by default.

36

�� ����� ��-����,� <����4������

• Show Run-TimeViewer duringplayback

• Toggle reportingon/off

• Give resultdirectoriesmeaningful names

General Options

• Save web pagesreturned duringplayback

Page 97: Lr7web Book 04a

Recording 2-37

2

Output.txt is overwritten each time a Vuser script is run. To preserve a copy of this log, make a copy of it, then rename the copy.

37

�� ����-����,� <�����4������

• Create a resultslog, output.txt

Click Run-Time Settings

*In the Controller, the default is "Disable logging."

• Standard log isthe default inVuGen*

Log tab:

Page 98: Lr7web Book 04a

2-38 LoadRunner for the Web 7.0

2

38

,� <���������� ��;��� 2���������

Default Run-Time Setting is "Ignore think times"(VuGen only*)

*In the Controller, the default is "Play think times as recorded."

Page 99: Lr7web Book 04a

Recording 2-39

2

You may create a new results directory for each run. The General Option Prompt for results directory is unchecked by default. When it is unchecked, new results overwrite the last results. You may find that in many cases, it is unnecessary to keep permanent results until you begin load testing.

39

������,�������8������.����� ��/

• Click the Run toolbar icon

• Accept the default, or type a results directory name

• Select Results Directory pop-up can be turned offin the General Options

Page 100: Lr7web Book 04a

2-40 LoadRunner for the Web 7.0

2

The results of each iteration of a script are stored separately. The Iteration0 directory is for system use and should be ignored by the tester.

40

����������,�������8�����

Tester createsthis part

C:\

Web_project

ScriptName2

-

ScriptName1+

-

data

Action1.c

-

Icons

Output.txt

Iteration0

Iteration1

+

+

+

result1

+

Report+

VuGen createsthis part

Page 101: Lr7web Book 04a

Recording 2-41

2

The Test Results window displays the results of:

■ the entire test run

■ each iteration of the run

■ each step of each iteration

41

Detailspane

2.6 VERIFY CORRECT VUSER EXECUTION

,�����������,������

Treepane

Vuser

result1

Results.qtp

Page 102: Lr7web Book 04a

2-42 LoadRunner for the Web 7.0

2

42

2.6 VERIFY CORRECT VUSER EXECUTION

,������-����� �����+����

Page 103: Lr7web Book 04a

Recording 2-43

2

The Execution Log is useful for debugging your Vusers. This tab shows messages about system events that occurred when the Vuser was running. The level of detail can be controlled by the Run-Time Settings in VuGen.

NOTE: Any line containing the word “Error” (with a capital “E” only) will be colored red in the Execution Log.

Please refer to the VuGen documentation for more information.

43

2.6 VERIFY CORRECT VUSER EXECUTION

,����������01����� �#��

• Look in theExecution Log tabbelow icon treepane

• The log is asequentialdisplay ofexecution andresult for eachstep

• Logging must beenabled in Run-Time Settings

Page 104: Lr7web Book 04a

2-44 LoadRunner for the Web 7.0

2

44

������

• An action contains recorded user actions

– may or may not contain application startup, login, logout– a Vuser may contain multiple actions

• Use Recording Options to control recording behavior

• Use General Options and Run-Time Settings to control Vuserrun behavior

• Check the Test Results window and the Execution Log afterrunning to make sure the Vuser ran correctly

Page 105: Lr7web Book 04a

Actions 2-45

Planning Specification (continued):

Book a Flight

USER ACTIONS EXPECTED RESULTS

1 Invoke the Web browser, typehttp://localhost/MercuryWebTours/ for the URL address and press Enter.

The Mercury Tours home page appears.

2 Type the name in the User Name box. The member’s login name appears in the Member name box.

3 Type the password in the Password box. The member’s password appears as a string of asterisks in the Password box.

4 Click the Sign-In button. The Mercury Tours FLIGHT FINDER page appears.

5 Type the following data in the indicated fields on the FLIGHT FINDER page.

The Find Flight page appears with the following flight information fields:- Type- Passengers- Departing From- On- Arriving In- Returning- Service Class- Airline

6 Click the CONTINUE button. The SELECT FLIGHT page appears and returns all values of available flights.

7 Select the first available flight and click the CONTINUE button.

The BOOK A FLIGHT page appears.

8 Type the following data in the indicated fields on the BOOK A FLIGHT page.

- First Name- Last Name- Number

Page 106: Lr7web Book 04a

2-46 LoadRunner for the Web 7.0

9 Click the SECURE PURCHASE button. The FLIGHT CONFIRMATION page appears. It contains confir-mation of the reserved flight, and the flight and customer details.

10 Verify that the FLIGHT CONFIRMATION page appears, and that the page contains the text “Your itinerary has been booked!”.

11 Verify the flight number. Flight details appear in the FLIGHT CONFIRMATION page.

USER ACTIONS EXPECTED RESULTS

Page 107: Lr7web Book 04a

Recording 2-47

2

Exercises

Preliminary Setup

This exercise may be skipped only if the setup has already been verified. As shipped, the Mercury Tours Demo Web Site has several boxes checked on the Administration page and no users in the database. Unless those boxes are unchecked, and at least one user is inserted, students will not be able to complete the exercises for this or any other lesson.

1. Start the Server.From the Windows Start menu, select Start Server from the Mercury Tours pro-gram group.Verify that the Start Server window displays the following line:

“Apache/1.3.17 <Win32> ApacheJServ/1.1.2 running...”After verifying, minimize the window.

2. Start the browser.

3. Navigate to the Mercury Tours Web site.In the URL space, type:

http://localhost/servlets/com.mercurytours.servlet.

WelcomeServlet

This is the URL for the training Web site.Press Enter.

4. Navigate to the Administration page.Sign in with User Name admin and Password mercury.Make sure that all boxes on the Administration page are unchecked.If any are checked, uncheck them.

5. Click the SUBMIT button.This should be done whether you had to uncheck any boxes or not.

Page 108: Lr7web Book 04a

2-48 LoadRunner for the Web 7.0

2

6. Navigate to the REGISTER page for new users.Click the REGISTER link in the Mercury Tours home page. The REGISTER page appears.

7. Complete the new member information.Enter values from the table for the fields shown. Leave blank any fields not shown in the table.

8. Finish registering the new user.Click SUBMIT.

9. Test the new account information.Click the SIGN-IN link in the Thank you message.Wait for the SIGN-ON page to appear.Sign in to Mercury tours using the new user name and password.

10. Sign off and close the browser.

FIELD VALUE

First Name Joseph

Last Name Frisbee

Country United States

UserName jojo

Password bean

Confirm Password bean

Page 109: Lr7web Book 04a

Recording 2-49

2

Exercise A: Create a Web Vuser

In these exercises you will create Web Vusers by recording on the training Web site. You will also run the Vusers you create, and review the test results.

IMPORTANT: Wait for all resources to download before performing the next step. Sometimes the status line says “Done.” but the browser downloads more after the progress bar has reset.

Record the Sign-InIn this section, you will create a Vuser that signs in to the training Web site and purchases a flight, by using VuGen to record an action containing those steps.

1. Invoke the Virtual User Generator (VuGen).From the Windows Start menu, select “Virtual User Generator” from the LoadRunner program group.

2. Create a new Web Vuser.Select File > New from the VuGen menu, or click the New button on the VuGen toolbar. The New Virtual User dialog box opens.Expand the E-Business folder, select “Web (HTTP/HTML),” and click OK.

3. Make sure that VuGen recording mode is HTML.Click the Recording Options toolbar button to open the dialog box.In the Recording tab, make sure that HTML-based script is selected for the Record-ing Mode, then click OK to close the dialog.

4. Rename Action1 to BookFlight.Right-click “Action1” in the Actions pane and select “Rename Action” from the pop-up menu. The Action1 label opens for editing.Overwrite “Action1” with BookFlight and press Enter.

!

Page 110: Lr7web Book 04a

2-50 LoadRunner for the Web 7.0

2

5. Start recording into BookFlight.Make sure that the first line in VuGen’s main window says “BookFlight”Select Vuser > Start Recording or click the Start recording your application toolbar button. The Start Recording dialog opens.If the following URL is not already present in the URL box, then type it in:

http://localhost/servlets/com.mercurytours.servlet.WelcomeServlet

Leave Record the application startup checked, and click OK.

Was the site under test invoked successfully by VuGen?

________________________________________________________________________

Why is it necessary for VuGen to invoke the browser?

________________________________________________________________________

________________________________________________________________________

6. In the browser, sign in to Mercury Tours as “jojo.”Type jojo in the User Name field under the Find A Flight section.Type bean in the Password field. Click the Sign-In button. The FLIGHT FINDER page appears.

In VuGen, what is it that indicates that the sign-in was recorded?

________________________________________________________________________

________________________________________________________________________

7. In Vugen, rename the com.mercurytours.servlet.SignonServlet step to Find-Flight.Right-click the “. . . Signon.Servlet” tree icon and select “Properties” from the pop-up menu. The Submit Data Step dialog box opens.Click the General tab.Overwrite the entire contents of the Step Name box with FindFlight.Click OK.

Page 111: Lr7web Book 04a

Recording 2-51

2

Record a Flight Purchase 1. In the browser, enter the flight details to search for available flights.

Accept the defaults for all fields on the FLIGHT FINDER page except those shown in the table below.

2. Click CONTINUE.

3. In Vugen, rename the com.mercurytours.servlet.ReservationServlet step to SelectFlight.

4. In the browser, accept the default flights for both directions of the round trip.By default, the first available flight is already selected for each direction when the SELECT FLIGHT page appears.Click the CONTINUE button.

5. In Vugen, rename the com.mercurytours.servlet.PurchaseServlet step to Pur-chaseFlight in the icon tree.

6. In the browser, type in the required credit card information.On the BOOK A FLIGHT page, fields which require data entry have red labels. Enter the passenger name and credit card number. Use data from the table.

7. Click SECURE PURCHASE.

FIELD VALUE

Departing From San Francisco

Arriving In New York

FIELD VALUE

First Name Joseph

Last Name Frisbee

Number 987654321

Page 112: Lr7web Book 04a

2-52 LoadRunner for the Web 7.0

2

Was the Flight Confirmation page received from the Web server?

________________________________________________________________________

8. Rename the . . . PurchaseServlet2 step to ConfirmFlight.

Record the Sign-Off 1. End the business process by signing off from the Web site.

In the browser, click the SIGN-OFF link (near the top of the page).

2. Stop recording.Click the Stop button in the floating Record toolbar.

3. Save the recording as: \web_project\Vusers\Lab2vuser1Select File > Save As, or click the Save toolbar button.

NOTE: For training purposes, a test framework was set up on one of your local drives under \web_project. The training will refer to this framework when sav-ing and opening lab exercises.

Was the Vuser added to the framework?

________________________________________________________________________

In light of the information gathered from the Transaction Mix, why is BookFlight considered a key business process to automate for load testing?

________________________________________________________________________

Play Back and Verify Correct Execution 1. Set VuGen to prompt for a results directory.

Select Tools > General Options. The General Options dialog box opens.Click the Display tab.Check the Prompt for results directory check box.Make sure that Generate report... and Display report... are checked.Click OK to save the options and close the dialog box.

Page 113: Lr7web Book 04a

Recording 2-53

2

2. Run the Vuser you created.Select Vuser > Run or press the Run button on the VuGen toolbar.Click OK to accept the default results directory result1.

3. Review the execution results.

In the Test Results window, what indicates that the Vuser run passed?

________________________________________________________________________

________________________________________________________________________

4. Review the Iteration 1 Summary.Click the Iteration 1 icon.

5. Display the Flight Confirmation page that VuGen captured during playback.Click the “+” sign to expand Iteration 1 in the Test Results icon tree. Click the step Web Submit Form: ConfirmFlight.

You can also expand all steps beneath a selected step by selecting View > Expand All, or by pressing the asterisk key [*] on the numeric keypad. (The other asterisk key will not work.)

Was an image of the Flight Confirmation page captured by the Test Results?

________________________________________________________________________

What are the file name and extension of the file that displays the test results?

________________________________________________________________________

6. Review the Execution Log at the bottom of the VuGen window.

To what do the messages in the Execution Log refer?

________________________________________________________________________

________________________________________________________________________

TIP

Page 114: Lr7web Book 04a

2-54 LoadRunner for the Web 7.0

2

7. Close the Test Results window.Click the close icon at the upper right corner of the title bar, or select File > Exit from the Test Results menu.

8. Close the Run-Time Viewer.If the window is restored, click the close icon at the upper right corner of the title bar.If the window is minimized, right-click the icon, and select “Close” from the pop-up menu.

9. Close Lab2vuser1.Select File > Close.

Page 115: Lr7web Book 04a

Recording 2-55

2

Review Questions

Validate your understanding of this lesson by answering the following questions:

1. For what purpose are Vusers created?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. What tools does VuGen provide to help you analyze Vuser run results?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 116: Lr7web Book 04a

2-56 LoadRunner for the Web 7.0

2

Page 117: Lr7web Book 04a

LoadRunner Transactions 3-1

LoadRunner Transactions

Page 118: Lr7web Book 04a

3-2 LoadRunner for the Web 7.0

3

2

��!������

• What a LoadRunner transaction is

• How a LoadRunner transaction functions in arecorded script

• How to implement LoadRunner transactions

In this lesson, you will learn:

Page 119: Lr7web Book 04a

LoadRunner Transactions 3-3

3

3

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 120: Lr7web Book 04a

3-4 LoadRunner for the Web 7.0

3

4

&��������'�� �� �����������

#�� ,� ���� �����

DEFINITION

An end-to-end (browser-to backend-tobrowser) measurement of one or moreuser actions within an action file.

Page 121: Lr7web Book 04a

LoadRunner Transactions 3-5

3

5

�������� ����� �

• Definition and placement of transactions shouldbe part of the planning process

• Implemented by adding Start Transaction andEnd Transaction steps

• May overlap and may be nested• May be added during or after recording

Page 122: Lr7web Book 04a

3-6 LoadRunner for the Web 7.0

3

6

• Transactions are LoadRunner’s only means formeasuring performance

• Measure high risk business processes

• Able to measure a single step or a group of steps

• Allow performance comparison between differentload tests

• Help to identify performance problems

����� �#�� ,� ��� ����� �%

Page 123: Lr7web Book 04a

LoadRunner Transactions 3-7

3

A LoadRunner transaction measures start to end performance of any user action that is made from the browser. “Start to end” means from the time an action occurs in the browser to the time the server response to that action appears in the browser.

Transaction measuring statements may be used to measure the duration of a particular business process or to measure specific events such as save, update and delete.

7

�����#�� ,� ���� ����� �������

Transaction 3 - measureonly the save order action

Transaction 2 - measureeverything that happens

after the login

Transaction 1 -measure thelogin actions

A LoadRunner transaction measures thesystem performance resulting from one ormore user actions

EXAMPLE

Page 124: Lr7web Book 04a

3-8 LoadRunner for the Web 7.0

3

8

������ ����� ����2

Webserver

Internet

LoadRunner transactions measure the interval betweenthe time an HTTP request is sent from the browser to thetime the HTTP server response is received by the browser

Browser

VuGenstart transactionsend URL1 receive web pageend transaction

Page 125: Lr7web Book 04a

LoadRunner Transactions 3-9

3

9

ADD LOADRUNNER TRANSACTIONS

8�� ��,�� � �

1. Click the Start Transaction toolbar button

2. Type aTransaction Nameand click OK

BEST PRACTICE

Page 126: Lr7web Book 04a

3-10 LoadRunner for the Web 7.0

3

10

ADD LOADRUNNER TRANSACTIONS

8�� ��,�� � �

4. Click the End Transaction toolbar button

3. Complete the user actions for the process to bemeasured

BEST PRACTICE

Page 127: Lr7web Book 04a

LoadRunner Transactions 3-11

3

11

���������� �������� ����� �� �

Common icons andusage examples

Start TransactionSet starting point for

measurement

End TransactionSet end point for

measurement

Page 128: Lr7web Book 04a

3-12 LoadRunner for the Web 7.0

3

12

ADD LOADRUNNER TRANSACTIONS

�"���,�� � �

2. Click the Start Transaction button from VuGen’smain toolbar

3. Select the last step to be measured

1. Select the first step to be measured

4. Click the End Transaction button from the toolbar

5. Select Transaction Status (optional)

Page 129: Lr7web Book 04a

LoadRunner Transactions 3-13

3

13

ADD LOADRUNNER TRANSACTIONS�AFTER RECORDING

��������� ����� �������

• LR_AUTO (the default)– use this when youwant LoadRunner todetect the transactionstatus automatically

• LR_PASS / LR_FAIL –use these when youwant to set thetransaction statusmanually in the code

Page 130: Lr7web Book 04a

3-14 LoadRunner for the Web 7.0

3

14

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 131: Lr7web Book 04a

LoadRunner Transactions 3-15

3

Deselect Prompt for results directory in Display tab of General Options dia-log box if you would rather have that as the default.

15

9)=�-��"�������01�����

1. Click theRun toolbarbutton

2. Select aresultsdirectory(optional)

Page 132: Lr7web Book 04a

3-16 LoadRunner for the Web 7.0

3

16

2.5 VERIFY CORRECT EXECUTION

���2�01����� �#��

Page 133: Lr7web Book 04a

LoadRunner Transactions 3-17

3

17

#�� ,� ���� ����� �� ������

TransactionName

TransactionResponse

Times

EXAMPLE

LoadRunner Analysis is covered in detail later

Page 134: Lr7web Book 04a

3-18 LoadRunner for the Web 7.0

3

18

����������� ����� �

• Measure performance of every test stepautomatically

• Compare individual steps– to each other– to an entire business process

Page 135: Lr7web Book 04a

LoadRunner Transactions 3-19

3

You can configure VuGen to measure every action of the Vuser automati-cally.

At the tester’s option, VuGen can add the action name and line number to the name of each automatic transaction for a step. Toggle that option on and off in the Preferences tab of the Run-Time Settings dialog.

19

����������� ����� �

Enable AutomaticTransactions in theRun-Time Settingsdialog box, Generaltab

NOTE: Automatic Transactions show up only in LoadRunner’s Analysisgraphs and reports, not in VuGen’s Execution Log. Automatic Transactionswill be covered in more detail later.

Page 136: Lr7web Book 04a

3-20 LoadRunner for the Web 7.0

3

20

������

• Use LoadRunner transactions to measure:– end-to-end response times of specific steps

in the business process– the entire business process– every step in the business process

automatically• Add LoadRunner transactions during or after

recording• Use automatic LoadRunner transactions to

measure every step without manually insertingtransactions

Page 137: Lr7web Book 04a

LoadRunner Transactions 3-21

3

Page 138: Lr7web Book 04a

3-22 LoadRunner for the Web 7.0

Planning Specification (continued):

Sign in and Display Itinerary

Determine how long the sign in and display itinerary process took.

USER ACTIONS EXPECTED RESULTS

1 Invoke the Web browser, typehttp://localhost/servlets/com.mercurytours .servlet.WelcomeServlet for the URL address, and press the Enter button.

The Mercury Tours home page appears.

2 Type a valid user name in the User Name box.

The typed characters are dis-played in the User Name box.

3 Type a valid password in the Password box. The user’s password appears as a series of asterisks in the Pass-word box.

4 Click the Sign-In button. A query is sent to the database to match an existing value for regis-tered user name and password. If a match is found, the Mercury Tours FLIGHT FINDER page appears.

5 After the FLIGHT FINDER page appears, click the ITINERARY button.

A Query is sent to the database to search for all flights reserved for the logged in user name. The ITINENARY page appears and displays all values returned by the database in response to the query.

Page 139: Lr7web Book 04a

LoadRunner Transactions 3-23

3

Exercises

LoadRunner transaction steps can be added to a script during recording and after recording. These exercises show you how to do both.

Exercise A: Add a Transaction During Recording

Create Vuser to Display ItineraryBased on the lesson presented and the planning specification, why would you want to add a LoadRunner transaction for the Display Itinerary process?

________________________________________________________________________

________________________________________________________________________

1. Create a new Web Vuser in VuGen.

2. Rename Action1 to DisplayItinerary.Right-click “Action1” in the Actions pane and select “Rename Action” from the pop-up menu. The Action1 label opens for editing.Overwrite “Action1” with DisplayItinerary and press Enter.

3. Start recording into DisplayItinerary.If the following URL is not already present in the URL box, then type it in:

http://localhost/servlets/com.mercurytours.servlet.WelcomeServlet

Leave Record the application startup checked, and click OK.

4. Sign in to the Mercury Tours Web site as jojo using the password bean.

Page 140: Lr7web Book 04a

3-24 LoadRunner for the Web 7.0

3

5. Wait for the FLIGHT FINDER page to appear, then start a LoadRunner transac-tion to measure displaying the itinerary.Click the Insert Start Transaction button from the floating Record toolbar. The Start Transaction dialog opens.Type display_itinerary in the Transaction Name field, and click OK.

6. Navigate to the Itinerary page.In the browser, click the ITINERARY link.

7. End the display_itinerary transaction using status LR_AUTO.Click the Insert End Transaction button on the floating Record toolbar. The End Transaction dialog opens with display_itinerary already in the Transaction Name box.Make sure the Transaction Status is LR_AUTO.Click OK.

How many flight reservations are listed in the itinerary?

________________________________________________________________________

8. In the browser, click SIGN-OFF and wait for the SIGN-ON page to appear.

9. Stop recording.

10. Save the script as: Lab3vuser1

Verify Correct Execution 1. Play back the test script.

Click OK to accept the default results directory result1.

In the Execution Log, how long did the display_itinerary transaction take in sec-onds? (HINT: Look at the blue line that begins: “Notify Transaction display_itinerary ended with Pass status....”)

________________________________________________________________________

Page 141: Lr7web Book 04a

LoadRunner Transactions 3-25

3

2. Close the Test Results window and the Run-Time Viewer.

Exercise B: Add a Transaction After Recording

Continue working with Lab3vuser1 created in the previous exercise.

1. Insert a LoadRunner start transaction step to measure sign-in performance.Select “DisplayItinerary” from the Actions list.Right-click the step com.mercurytours.servlet.SignonServlet in the icon tree, and select “Insert Before” from the pop-up menu. The Add Step dialog opens.Select “Start Transaction” from the Step Type list, and click OK. The Start Transac-tion window opens.Type sign-in in the Transaction Name field and click OK.

2. Insert a LoadRunner end transaction step.Right-click the ...SignonServlet step again, and select “Insert After.”In the Add Step dialog select “End Transaction” from the list, and click OK.Click OK to accept sign-in as the Transaction Name and LR_AUTO as the Transaction Status.

3. Save the Vuser.

4. Run the modified Lab3vuser1.Click OK to accept the default results directory result2.

How long did the sign-in transaction take in seconds?

________________________________________________________________________

5. Close the Test Results window, the Run-Time Viewer, and Lab3vuser1.

Page 142: Lr7web Book 04a

3-26 LoadRunner for the Web 7.0

3

Review Questions

1. What is the purpose of a LoadRunner transaction?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. What is the purpose of measuring a business process from start to end?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

3. What is the easiest way to get measurements for each step of a recorded script? For an entire action?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 143: Lr7web Book 04a

Verification Checkpoints 4-1

Verification Checkpoints

Page 144: Lr7web Book 04a

4-2 LoadRunner for the Web 7.0

4

2

��!������

In this lesson you will learn:

• The definition and function of a checkpoint

• The importance of functional testing under load

• Visual cues to check for during load testing

• The types of checks in VuGen– what can be verified on a web page– how VuGen verifies Web application

functionality

• How to add verification checkpoints duringrecording

Page 145: Lr7web Book 04a

Verification Checkpoints 4-3

4

■ Verify functionality under load—Because a few users do not stress the system, business processes may sometimes perform correctly under the load of just a few users.

■ Transaction passes; business process fails—Under the stress of many concurrent users, a server might not be able to send back the proper pages, thus preventing the business process from functioning prop-erly.

■ Synchronization of multiple servers—When a backup server is moved to production, it’s wise to verify that the backup truly “mirrored” the former production server.

3

����'������2��� ��%

EXAMPLE Slideshow SearchResults Page

Displayimage

Wrong imageis displayed

Find an item

"Not found"on right page

BusinessProcess

Problem

Any

Link is broken

Shopping Site

• Verify correct functionality under load• A transaction may report a pass even though the

business process failed• To ensure synchronization when a backup server

is used

Page 146: Lr7web Book 04a

4-4 LoadRunner for the Web 7.0

4

4

&��������'�� �� �����������

(� ��� �������� �' ��#��

DEFINITION

Confirming that all business processescomplete properly while the serverhandles concurrent usage.

Page 147: Lr7web Book 04a

Verification Checkpoints 4-5

4

The appearance of expected visual cues indicates that the server can send the proper pages back and that the load is being properly handled.

5

4��� ����+����������������

text visual

cue

Expectedresult

appears;verification

passes

Page 148: Lr7web Book 04a

4-6 LoadRunner for the Web 7.0

4

6

4��� ����+�����*�����������

Expectedresult doesnot appear;verification

fails

Page 149: Lr7web Book 04a

Verification Checkpoints 4-7

4

7

&��������'�� �� �����������

���2��� �

DEFINITION

A checkpoint is a step in a Vuser scriptwhich verifies whether a visual cueappeared as expected.

Verification always results in a PASS or FAIL status

Page 150: Lr7web Book 04a

4-8 LoadRunner for the Web 7.0

4

8

#�� ,� ��-��"����� ����2��� ��

Vuserstart transactionsend URL1receive web pageend transactionpage checkpoint

Verification tells you whether a Webapplication is behaving as intended

REVIEW

Page 151: Lr7web Book 04a

Verification Checkpoints 4-9

4

9

���������2��� ��

• Allow you to verify the content returned by yourWeb application– pages, images, text, objects, tables– image source, broken links

• Implemented with checkpoint steps

• Report pass or fail to Test Results window and toExecution Log

• Can be inserted during recording or afterward

Page 152: Lr7web Book 04a

4-10 LoadRunner for the Web 7.0

4

10

�����-������������� "��4��� ����+����������%

Where in the businessprocess might loadoverwhelm the server(s)and cause failure?

What visual cues inthe browser indicatesuccess?

Web-basedbookseller

Extranet newsphoto archive

• Search• Submit order

Results pageinstead of errormessage

Image request

Expected imagedisplayed

Order EntryIntranet Site

Inserting asales orderinto thedatabase

Order numberappears

EXAMPLE CASESCENARIOS

Page 153: Lr7web Book 04a

Verification Checkpoints 4-11

4

11

����-������'����-��"�(� ��� �����

LoadRunner

(2) during playback, compares the actual value onthe web page to the expected value.

(3) sends the comparison result (the "status") aseither PASS or FAIL to a file.

(1) captures the information (determined by theuser) used to perform the check.

You can see the result in the Test Results windowand the Execution Log after the run.

Page 154: Lr7web Book 04a

4-12 LoadRunner for the Web 7.0

4

12

����#�� ,� ��-��"���

PASS

Test Results

ACTUAL EXPECTED

Actualmatchesexpected

?

RESULT

COMPARE

Page 155: Lr7web Book 04a

Verification Checkpoints 4-13

4

13

TuneSystem Based

on Analysis

#�� ,� ��01������2"����36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 156: Lr7web Book 04a

4-14 LoadRunner for the Web 7.0

4

One reason to add checks during recording is that it might be easier than try-ing to remember where they should go by looking at the recorded script, espe-cially if you are unfamiliar with the application under test.

14

���2��� ��;��� �+�����

• Add text and image checks during recording

• Give the checkpoint a name that describes whatis being verified

• Make sure that Enable checks is checked in theRun-Time Settings, General tab, before runningthe recorded Vuser script

Page 157: Lr7web Book 04a

Verification Checkpoints 4-15

4

15

���������2

Did the Web pagedisplay the correctimage?

Example usageCheck

Image

Page 158: Lr7web Book 04a

4-16 LoadRunner for the Web 7.0

4

Once you have determined the visual cue(s) which verify the functionality of the business process, the next step is to determine the type of check to use. Determination should be made based on the content and appearance of the visual cue.

Because visual cues vary in content and appearance, VuGen provides differ-ent types of checks you can use to verify that the business process is function-ing properly.

16

8����� ��-��������������-��"�

Same imagewhenever

page is loaded

Useimagecheck

Page 159: Lr7web Book 04a

Verification Checkpoints 4-17

4

17

������#�� ,� �����������2�

• Only the image name is stored–not the image itself

• An image check verifies that the image name isreferenced in the Web page

• The following slides show:– how to determine the image name– how to use the image name to create an image check

Page 160: Lr7web Book 04a

4-18 LoadRunner for the Web 7.0

4

18

����� ��� ����������2;8�� �,�� � �

a. In the browser,right click onimage to bechecked

b. Select "SavePicture As…"from pop-upmenu

1. While recording,get the imagename

BEST PRACTICE

Page 161: Lr7web Book 04a

Verification Checkpoints 4-19

4

The Save Picture dialog appears with the name of the image file automatically displayed in the File name field. Copy the name and extension of the file.

There might be instances where the file extension (.gif, .jpg, etc.) doesn’t auto-matically appear. Append the extension by typing it in the box manually, then perform the copy.

19

����� ��� ����������2;8�� �,�� � �

c. Copy existingfile name usingCtrl + C

d. Click Cancel

NOTE: If the file extension (.gif, .jpg, etc.) does not appear,type it in the File name edit field yourself before copying

BEST PRACTICE

Page 162: Lr7web Book 04a

4-20 LoadRunner for the Web 7.0

4

20

a. Click the InsertAfter toolbar button

����� ��� ����������2;8�� �,�� � �

b. The Add Stepdialog opens

2. Add the step

The Image CheckProperties dialogopens.

c. Expand WebChecks, select"Image Check,"and click OK.

BEST PRACTICE

Page 163: Lr7web Book 04a

Verification Checkpoints 4-21

4

The image file name pasted into the check properties becomes the expected result of the check.

21

a. Check the Imageserver file name (SRCattribute) check box

����� ��� ����������2;8�� �,�� � �

b. Paste the file nameinto the edit box usingCtrl + V

3. Paste the file name intoImage Check Properties

BEST PRACTICE

Page 164: Lr7web Book 04a

4-22 LoadRunner for the Web 7.0

4

Providing a more descriptive name for this check makes it easier to follow the actions in the icon tree.

22

����� ��� ����������2;8�� �,�� � �

a. Click theGeneral tab

b. Change the StepName from default"web_image_check"to a moredescriptive name

c. Click OK to finish

4. Rename the step

BEST PRACTICE

Page 165: Lr7web Book 04a

Verification Checkpoints 4-23

4

23

����� ��� ����������2;8�� �,�� � �

The imagecheck step isdisplayed inthe Icon Treeunder thepage wherethe imageappears

BEST PRACTICE

Page 166: Lr7web Book 04a

4-24 LoadRunner for the Web 7.0

4

24

Did the business processcomplete successfully?

��1�����2

Example usageCheck

Text

Page 167: Lr7web Book 04a

Verification Checkpoints 4-25

4

25

ADD VERIFICATION CHECKS

��1�����2;8�� ��,�� � �

1. Select textto check inthe browser

2. Click theText Checktoolbarbutton–thecheck isaddedautomatically

3. Continuerecording

BEST PRACTICE

Page 168: Lr7web Book 04a

4-26 LoadRunner for the Web 7.0

4

26

TuneSystem Based

on Analysis

#�� ,� ��01������2"����36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 169: Lr7web Book 04a

Verification Checkpoints 4-27

4

In order for the Vuser to perform the checks, the Verification checks check box in the Preferences tab must be checked. Use this option to make sure that the Vuser is running correctly. Because performing checks can slow down the Vuser execution, you might want to uncheck this setting during actual load tests.

27

SETUP FOR EXECUTION

0 ��������2��� �,� <��������� ��

Page 170: Lr7web Book 04a

4-28 LoadRunner for the Web 7.0

4

28

VERIFY CORRECT EXECUTION

���2������,��������� ��

FAILED EXAMPLETest Status = FailedCheck/Text = Red

Page 171: Lr7web Book 04a

Verification Checkpoints 4-29

4

29

PASSED EXAMPLETest Status = PassedCheck/Text = Green

VERIFY CORRECT EXECUTION

���2������,��������� ��

Page 172: Lr7web Book 04a

4-30 LoadRunner for the Web 7.0

4

30

VERIFY CORRECT EXECUTION

���2�-��� �01����� �#��

FAILED EXAMPLE

PASSED EXAMPLE

Page 173: Lr7web Book 04a

Verification Checkpoints 4-31

4

31

ADD VERIFICATION CHECKS

��1�����2��"���,�� � �

The Text Check Properties dialog opens.2. Expand Web Checks, select "Text Check," and click OK.

1. Right-click a step and select"Insert After" from the pop-up menu

Page 174: Lr7web Book 04a

4-32 LoadRunner for the Web 7.0

4

32

ADD VERIFICATION CHECKS

��1�����2;�"���,�� � �

5. Click the General tab

6. Overwrite "web_find"with a moredescriptive name

3. Type the text tocheck in theSearch for box

4. Type left and rightboundaries (optional)

Page 175: Lr7web Book 04a

Verification Checkpoints 4-33

4

33

���2� ��"��� �0��+���

Q: If you check for an error page and the error pageis found, should the Vuser pass?

A: No.

Q: So, how do you make NOT finding the text a PASScondition, and finding the text a FAIL condition?

ADVANCED

Page 176: Lr7web Book 04a

4-34 LoadRunner for the Web 7.0

4

Note that in this example, the test should pass if the error text is NOT found.

34

�� �"�����2�+�������

1. Open Text CheckProperties dialog,General tab

2. Uncheck View onlythe active properties

3. In the Expect row,select "NotFound"from Value list

4. Click the box tothe left of Expect

ADVANCED

Page 177: Lr7web Book 04a

Verification Checkpoints 4-35

4

35

������

• Determine the visual cues you will check to verifyeach business process

• Add text and image checks during recording

• Make sure that Enable verification checks ischecked in the Run-Time Settings, Preferences tabbefore running the Vuser

• LoadRunner compares expected information toactual information obtained during the run

• The check status is always PASS or FAIL

Page 178: Lr7web Book 04a

4-36 LoadRunner for the Web 7.0

4

Page 179: Lr7web Book 04a

Verification Checkpoints 4-37

Planning Specification (continued):

Book a Flight

USER ACTIONS EXPECTED RESULTS

1 Invoke the Web browser, typehttp://localhost/MercuryWebTours/ for the URL address and press Enter.

The Mercury Tours home page appears.

2 Type the name in the User Name box. The member’s login name appears in the Member name box.

3 Type the password in the Password box. The member’s password appears as a string of asterisks in the Password box.

4 Click the Sign-In button. The Mercury Tours FLIGHT FINDER page appears.

5 Type the following data in the indicated fields on the FLIGHT FINDER page.

The Find Flight page appears with the following flight information fields:- Type- Passengers- Departing From- On- Arriving In- Returning- Service Class- Airline

6 Click the CONTINUE button. The SELECT FLIGHT page appears and returns all values of available flights.

7 Select the first available flight and click the CONTINUE button.

The BOOK A FLIGHT page appears.

8 Type the following data in the indicated fields on the BOOK A FLIGHT page.

- First Name- Last Name- Number

Page 180: Lr7web Book 04a

4-38 LoadRunner for the Web 7.0

9 Click the SECURE PURCHASE button. The FLIGHT CONFIRMATION page appears. It contains confir-mation of the reserved flight, and the flight and customer details.

10 Verify that the FLIGHT CONFIRMATION page appears, and that the page contains the text “Your itinerary has been booked!”.

11 Verify the flight number. Flight details appear in the FLIGHT CONFIRMATION page.

USER ACTIONS EXPECTED RESULTS

Page 181: Lr7web Book 04a

Verification Checkpoints 4-39

4

Exercises

In this lab, you will create a Vuser to book a flight. During recording you will add the checks necessary to verify the business process. Continuation of the Planning Specification is provided as your reference for input data.

Why is it recommended to add verification checks to your Vusers?

________________________________________________________________________

________________________________________________________________________

Exercise A: Add Verification Checkpoints to a Vuser

Begin Recording a Book Flight Vuser 1. Create a new Web Vuser in VuGen.

2. Rename Action1 to BookFlight.

3. Start recording into BookFlight.If the following URL is not already present in the URL box, then type it in:

http://localhost/servlets/com.mercurytours.servlet.WelcomeServlet

Leave Record the application startup checked, and click OK.

4. Sign in to the Mercury Tours Web site as jojo with the password bean.

5. Rename the com.mercurytours.servlet.SignonServlet step to FindFlight.Please refer to Lesson 2 if you need help completing this step.

Page 182: Lr7web Book 04a

4-40 LoadRunner for the Web 7.0

4

6. Enter the flight details to search for available flights.Accept the defaults for all fields in the FLIGHT FINDER page except those shown in the table below.

7. Click CONTINUE.

8. Rename the com.mercurytours.servlet.ReservationServlet step to SelectFlight.

9. Accept the first available flight for both directions of the round trip.Click the CONTINUE button on the SELECT FLIGHT page.

10. Rename the com.mercurytours.servlet.PurchaseServlet step to Purchase-Flight.

Verify Text 1. Add a Start Transaction step called purchase_flight.

If you need help with this step, please refer to Lesson 3.

2. Enter the passenger and credit card information in The BOOK A FLIGHT page.Use data from the following table.

3. Click SECURE PURCHASE.

FIELD VALUE

Departing From San Francisco

Arriving In New York

FIELD VALUE

First Name Josephine

Last Name Frisbee

Number 123456789

Page 183: Lr7web Book 04a

Verification Checkpoints 4-41

4

4. Rename the com.mercurytours.servlet.PurchaseServlet2 step to Confirm-Flight.

5. End the purchase_flight transaction with status LR_AUTO.

Was the flight confirmation page returned from the Web server?

________________________________________________________________________

What other visual cues indicate that the reservation was created successfully?

________________________________________________________________________

6. Create a check to find the text “Your itinerary has been booked”.Highlight the text “Your itinerary has been booked” in the browser (omit the exclamation point).Click the Insert Text Check button on the Record floating toolbar.

Was the text check added? How do you know?

________________________________________________________________________

7. Rename the Text Check to VerifyItinerary.In VuGen, right-click the Text Check step and select “Properties” from the pop-up menu. The Text Check Properties dialog box opens.Make sure that the text you wanted to check appears in the Search for box.Click the General tab.Replace “Text Check” with VerifyItinerary in the Step Name box.Click OK to close the Text Check Properties dialog.

Verify an Image 1. Find the flight confirmation image file name.

In the browser, right-click the words “FLIGHT CONFIRMATION” on the FLIGHT CONFIRMATION page.Select “Save Picture As” from the pop-up menu. The name of the image file is dis-played in the File name field of the Save Picture dialog.

Page 184: Lr7web Book 04a

4-42 LoadRunner for the Web 7.0

4

What is the name of the flight confirmation image? Write the file name (including the file extension) in the space below.

img src = _______________________________________________________________

2. Copy the file name to the Windows clipboard.If the file name is not yet selected, select it, then press Ctrl+C.

3. Close the Save Picture dialog without saving.Click Cancel.

4. Add an image check to verify that the flight confirmation image appears.In the VuGen window, right-click the End Transaction step in the icon tree.Select “Insert After” from the pop-up menu. The Add Step dialog box opens.Expand the Web Checks category.Select “Image Check,” and click OK. The Image Check Properties dialog opens.Check the Image server file name (SRC attribute) check box.Paste the file name into the file name box by pressing Ctrl+V, then add the .gif extension.

5. Rename the web_image_check to VerifyFlightConfirmPage.Click the General tab in the Image Check Properties dialog box.Replace “web_image_check” in the Step Name box with VerifyFlightConfirm-Page.Click OK to close the Image Check Properties dialog box.

Was the image check added to the icon tree?

________________________________________________________________________

Why do you think you were asked to put the image check after the End Transac-tion step, rather than after the ConfirmFlight step?

________________________________________________________________________

________________________________________________________________________

6. In the browser, click SIGN-OFF and wait for the SIGN-ON page to appear.

Page 185: Lr7web Book 04a

Verification Checkpoints 4-43

4

7. Stop recording, then save the script as: \web_project\Vusers\Lab4vuser1

Verify Correct Execution 1. Enable verification checks in the Run-Time Settings.

Click the Run-Time Settings toolbar button.Check Verification checks in the Preferences tab.Click OK to save the changes.

2. Run Lab4vuser1.Click OK to accept the default results directory result1.

3. Review the test results.Click the Iteration 1 icon in the Test Results window. Each step in the script is rep-resented on the Test Iteration 1 Summary page.

Did the Vuser execute successfully?

________________________________________________________________________

How does the Iteration 1 Summary show that the checks passed? How would it show a check failure?

________________________________________________________________________

________________________________________________________________________

4. Compare the text on the Iteration 1 Summary page with the text on the Image Check page and the Web Find page.

Are the key words from the Iteration Summary page also present on the check-point pages?

________________________________________________________________________

5. Close the Test Results window, the Run-Time Viewer, and Lab4vuser1.

Page 186: Lr7web Book 04a

4-44 LoadRunner for the Web 7.0

4

Review Questions

Validate your understanding of this lesson by answering the following questions:

1. What is a good reason to verify functionality under load with checkpoints?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. How do you determine which visual cues to verify during load testing?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 187: Lr7web Book 04a

Data Parameterization 5-1

Data Parameterization

Page 188: Lr7web Book 04a

5-2 LoadRunner for the Web 7.0

5

2

��!������

In this lesson you will learn:

• What parameters are and how they work• How parameterization can help to solve some

playback problems• How to parameterize input fields

Page 189: Lr7web Book 04a

Data Parameterization 5-3

5

3

&��������'�� �� �����������

+������

DEFINITION

A parameter is a placeholder which re-places a recorded value in a Vuser script.At run time, a value from an externalsource is substituted for the parameter.

Page 190: Lr7web Book 04a

5-4 LoadRunner for the Web 7.0

5

4

+����������� ����8���

Vuserstart transactionsend XRunnerreceive web pageend transactionpage checkpoint

During a run, VuGen replaces each parameter witha value from a data file or another external source, and inputs it to the Web application

Vuserstart transactionsend {MIproduct}receive web pageend transactionpage checkpoint

Page 191: Lr7web Book 04a

Data Parameterization 5-5

5

5

������+������������

• Parameterization lets you substitute many valuesfor one recorded value

• You may parameterize input data andcheckpoints

• Parameterization can help to solve problemsaffecting load testing

Page 192: Lr7web Book 04a

5-6 LoadRunner for the Web 7.0

5

6

��!��������"�+������������

Solve certain problems that may occur duringplayback:

• Date constraints make recorded date invalid• Unique constraints prevent reusing recorded data• Data caching

– response times are inaccurate– real user activity is not emulated– servers are not exercised

Page 193: Lr7web Book 04a

Data Parameterization 5-7

5

7

TuneSystem Based

on Analysis

#�� ,� ��01������2"����36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

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 194: Lr7web Book 04a

5-8 LoadRunner for the Web 7.0

5

Part of the planning process involves determining the fields that you need to parameterize before you begin creating the Vusers.

8

7):�8����� �������(��� ����+���������

• Which fields require a current date?

• Which fields require unique values?

• Which fields exercise the database server?

Page 195: Lr7web Book 04a

Data Parameterization 5-9

5

9

8������ ���� �

• Business process works only for the current date

• Vuser works only on the date it was recorded

• Parameterize the input date

• Use a Date Type parameter to make the Vuserwork for any current date

SOLUTION

PROBLEM

Page 196: Lr7web Book 04a

5-10 LoadRunner for the Web 7.0

5

A date that is hard-coded in the Vuser during recording may no longer be valid when that date has passed. Parameterizing the date allows Vuser execution to succeed by replacing the hard-coded date.

10

8������ ���� �

Webserver

Internet

Today is July 1,2001. You mustenter a valid date.

Reserve seaton Flight 876June 30, 2001

EXAMPLE

Page 197: Lr7web Book 04a

Data Parameterization 5-11

5

11

' �>���8������ ���� �

• Each product in inventory requires a unique IDnumber

• Once it’s in the system, a product ID numbercannot be added again for a different product

• How to measure the performance of the processwhich creates a new product?

• Parameterize the product ID number field

• After running, delete the test ID numbers fromthe system so the Vuser can be run again

SOLUTION

PROBLEM

Page 198: Lr7web Book 04a

5-12 LoadRunner for the Web 7.0

5

A field that uses unique data is constrained because the business process will not allow reuse of the data after it has been added to the system and processed.

In the example shown above, the first run failed because the script tried to reuse the recorded product ID.

12

' �>���8������ ���� �

EXAMPLE

Webserver

Internet

Product ID 36901is in use.Please chooseanother product ID.

Add productID 36901.

Page 199: Lr7web Book 04a

Data Parameterization 5-13

5

13

8�����������

• Vusers all use the same data

• Data caching makes load test response timesshorter than when real users load the system

• Parameterize input data to force the system toget data from a database

SOLUTION

PROBLEM

Page 200: Lr7web Book 04a

5-14 LoadRunner for the Web 7.0

5

Data gets relocated in the server’s cache when it is reused for each Vuser execution. As a result, server activity is not emulated during playback. While Vuser execution is successful, it will not produce test results mean-ingful for load testing because the server is not exercised.

Using different data better emulates server activity and exercises the sys-tem. That improves the chances for meaningful load test results.

14

8�����������

Internet

Data fromdatabase

Request 1

EXAMPLE

Database

Web server

&$&+(

Repeatrequest 1

Data fromcache

Page 201: Lr7web Book 04a

Data Parameterization 5-15

5

15

TuneSystem Based

on Analysis

#�� ,� ��01������2"����36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

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 202: Lr7web Book 04a

5-16 LoadRunner for the Web 7.0

5

16

7)?�0��������������8�������'��

• Extract master data from database

• Create valid transactional data– predict according to type of data– obtain from a functional expert

10/16/2002

$230.59 SMITH, WM.

TRUE

Page 203: Lr7web Book 04a

Data Parameterization 5-17

5

17

TuneSystem Based

on Analysis

#�� ,� ��01������2"����36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 204: Lr7web Book 04a

5-18 LoadRunner for the Web 7.0

5

18

�������+����������� ���

1. Determine which fields to parameterize

2. Replace recorded values with parameters

3. Decide which parameter type to use

4. Choose the data access method and the numberof iterations

5. Run the Vuser and analyze the results to verifycorrect execution

PROCESS

Page 205: Lr7web Book 04a

Data Parameterization 5-19

5

19

+������������

Each type replaces a parameter with:

• Date/Time – current date and/or time

• File – data from a text file

• Group Name – name of Vuser Group (see Scenarios lesson)

• Iteration Number – current iteration number

• Load Generator Name – name of the machine on which the Vuseris running (see Scenarios lesson)

• Random Number – from a user-defined range of numbers

• Unique Number – from user-defined start number and block size

• User Defined Function – data generated by a function from anexternal DLL

• Vuser ID – ID assigned to the Vuser by the Controller during ascenario run (see Scenarios lesson)

For information about parameter types not discussed in this course,please consult your LoadRunner documentation

Page 206: Lr7web Book 04a

5-20 LoadRunner for the Web 7.0

5

20

PARAMETERIZE INPUT DATA

��� ����������+�������

2. Right-click the step which inputs data to the field

1. Identify the field to parameterize (from the Planning Specification)

3. Select"Properties"

VUSER DESIGN SPECIFICATION

Field Data

MIproduct search_button

query Astra SiteTestLoadRunnerTestDirectorWinRunnerXRunner

Page 207: Lr7web Book 04a

Data Parameterization 5-21

5

A data file is a text file that holds the name of the parameter you defined and the data you will use to replace the parameter with during the run.

21

VUSER DESIGN SPECIFICATION

Field Data

MIproduct search_button

query Astra SiteTestLoadRunnerTestDirectorWinRunnerXRunner

PARAMETERIZE INPUT DATA

������������������+������

1. Click Parameter button next to the recorded value

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

3. Select a Parameter typefrom the list

Page 208: Lr7web Book 04a

5-22 LoadRunner for the Web 7.0

5

22

PARAMETERIZE INPUT DATA

��� �����+�������+�������

1. Click the Properties button2. Click the Create button and confirm a new file

Page 209: Lr7web Book 04a

Data Parameterization 5-23

5

LoadRunner uses the parameter name with the extension .dat as the sug-gested name for a new data file. You may use any name you like.

23

PARAMETERIZE INPUT DATA

��� �����8����(���

• Click Editbutton to openthe new datafile in WindowsNotepad

FILE NAME

• Parameter.datfile is added toVuser folder

Page 210: Lr7web Book 04a

5-24 LoadRunner for the Web 7.0

5

24

VUSER DESIGN SPECIFICATION

Field Data

MIproduct search_button

query Astra SiteTestTestDirectorLoadRunnerWinRunnerXRunner

PARAMETERIZE INPUT DATA

� �8�����������(���

• Enter new data in the Notepad window

• Press Enter after typing each data item (includingthe last item)

PARAMETERNAME

• Close Notepad and save thechanges

DATA

Page 211: Lr7web Book 04a

Data Parameterization 5-25

5

25

PARAMETERIZE INPUT DATA

(����8������������ �+������+�������

• In the ParameterProperties dialog,data from the fileappears in tableform

• Multiple columnsfor differentparameters areallowed in thesame data file

Page 212: Lr7web Book 04a

5-26 LoadRunner for the Web 7.0

5

If the access method for parameter1 is random, for example, the tester can specify Same line as parameter1 as the access method for parameter2. In this way, data dependencies can be preserved.

26

����������8��������������

• Sequential• Random• Unique• Same line as

{parameter}

Select next row tells LoadRunnerin what order to use data from the file

Page 213: Lr7web Book 04a

Data Parameterization 5-27

5

VuGen reads one row of data per iteration beginning with the first row. In a load test scenario, it is likely that many Vusers will run the same script. With the sequential access method, each Vuser uses the 1st data row for iteration 1, row 2 for iteration 2, etc.

27

��>�� �����,������� �������

• Each Vuser uses the same row of data for eachiteration

• Row 1 is used for iteration 1, Row 2 for iteration 2,etc.

EXAMPLE

aaa aaa aaa

bbbbbbbbb

ccc ccc ccc

Iteration 1

Iteration 2

Iteration 3

Vuser 1 Vuser 2 Vuser 3

��>�� ����

Page 214: Lr7web Book 04a

5-28 LoadRunner for the Web 7.0

5

The data row is chosen randomly for each iteration. Some data may be reused. The more iterations and Vusers you run, the more likely it is that data will be reused.

28

,� ���,������� �������

• Rows are selected randomly by LoadRunner atrun time

• Uniqueness is not guaranteed

EXAMPLE

ddd aaa eee

eeecccfff

ggg bbb bbb

Iteration 1

Iteration 2

Iteration 3

Vuser 1 Vuser 2 Vuser 3

,� ��

Page 215: Lr7web Book 04a

Data Parameterization 5-29

5

The data file is separated into “blocks” of rows; each block is assigned to only one Vuser per run. VuGen reads one row of data per iteration begin-ning with the first row of the block assigned to each Vuser.

In this example, the Unique replacement method shows data blocks assigned in Vuser order. In fact, data blocks are assigned in the order that Vusers are initialized. That may or may not be the same as Vuser ID order.

29

' �>���,������� �������

• Each Vuser has a block of rows for its exclusiveuse

• LoadRunner expert must ensure uniqueness ofdata in the table

EXAMPLE

aaa ddd ggg

hhheeebbb

ccc fff iii

Iteration 1

Iteration 2

Iteration 3

Vuser 1 Vuser 2 Vuser 3

' �>��

Page 216: Lr7web Book 04a

5-30 LoadRunner for the Web 7.0

5

30

BEFORE PARAMETERIZATION

+������������ ;�����-���

EXAMPLE

Page 217: Lr7web Book 04a

Data Parameterization 5-31

5

31

+������������ ;�����-���

EXAMPLE

NOTE: Tree View shows no differences

AFTER PARAMETERIZATION

Page 218: Lr7web Book 04a

5-32 LoadRunner for the Web 7.0

5

32

PARAMETERIZE INPUT DATA

����������������+������

• Choose"Date/Time"from theParametertype list

• ChooseDate/TimeformatfromParameterProperties

Page 219: Lr7web Book 04a

Data Parameterization 5-33

5

33

TuneSystem Based

on Analysis

#�� ,� ��01������2"����36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 220: Lr7web Book 04a

5-34 LoadRunner for the Web 7.0

5

The number of iterations assigned to a given business process should be based on the expected throughput for that process. The throughput (the number of processes occurring in a certain time period) should be extracted from a Transaction Profile (developed during the planning phase).

34

VERIFY CORRECT EXECUTION

,� <���������� ������������ �

To test all data using the Sequential access method, Number ofIterations should equal the number of rows in the data file

Page 221: Lr7web Book 04a

Data Parameterization 5-35

5

In order to view the parameters and their values in the output logs after playback, the options shown above must be set.

35

VERIFY CORRECT EXECUTION

,� <���������� �����#��

• Disable loggingbefore loadtesting

• To seeparameter datain the ExecutionLog, selectExtended logand Parametersubstitution inthe Run-TimeSettings

Page 222: Lr7web Book 04a

5-36 LoadRunner for the Web 7.0

5

The Execution Log lists parameters and their values for each iteration dur-ing Vuser playback.

36

VERIFY CORRECT EXECUTION

01����� �#��

Iteration 1

Page 223: Lr7web Book 04a

Data Parameterization 5-37

5

37

VERIFY CORRECT EXECUTION

01����� �#��

Iteration 2

Page 224: Lr7web Book 04a

5-38 LoadRunner for the Web 7.0

5

38

VERIFY CORRECT EXECUTION

�����,��������� ��

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

Page 225: Lr7web Book 04a

Data Parameterization 5-39

5

A dynamic visual cue is a value used as input data which is obtained from a parameter in the Vuser.

How can you check for these values that change from one iteration to the next?

39

���2� ��8� ����-����������

How tocheck ?

Visual Cue may be:• paulb• sathya• jojo• eric• franz

depending on the input data

Page 226: Lr7web Book 04a

5-40 LoadRunner for the Web 7.0

5

You can assign a text check to look for values that exist in a data file. This is an effective way to verify the appearance of a parameterized value.

40

���2� ����-����������� ���� ������+������

1. Add a text check to aparameterized step

2. Click the ABC button

3. Select the step’sparameter from the listand click OK

LoadRunner will nowcheck for the value ofthe parameter duringeach iteration

Page 227: Lr7web Book 04a

Data Parameterization 5-41

5

Don’t parameterize a field unless you have a good reason to do so.

41

������

• Parameterize fields in order to:– solve unique data constraints– solve date constraints– exercise the server(s)

• Determine what input data to use:– 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 228: Lr7web Book 04a

Data Parameterization 5-42

Page 229: Lr7web Book 04a

Data Parameterization 5-43

Planning Specification (continued):

Create New User Account

USER ACTIONS EXPECTED RESULTS

1 Click the REGISTER button. The REGISTER page appears.

2 In the REGISTER page, type the information for creating a new user.Fields in red may not be left blank.

Customer information is dis-played in the fields:- First Name- Last Name- Phone- E-mail- Address- City- State- Postal Code- Country- User Name- Password- Confirm Password

3 Click the Submit button. The new user is added into the database and the Mercury Tours REGISTER page appears with confirmation.

Page 230: Lr7web Book 04a

5-44 LoadRunner for the Web 7.0

Display Itinerary

USER ACTIONS EXPECTED RESULTS

1 Invoke the Web browser, typehttp://localhost/servlets/com.mercurytours .servlet.WelcomeServlet for the URL address, and click the Sign-In button.

The Mercury Tours home page appears.

2 Type a valid user name in the User Name box.

The typed characters are dis-played in the User Name box.

3 Type a valid password in the Password box. The user’s password appears as a series of asterisks in the Pass-word box.

4 Click the Sign-In button. A query is sent to the database to match an existing value for regis-tered user name and password. If a match is found, the Mercury Tours FLIGHT FINDER page appears.

5 After the FLIGHT FINDER page appears, click the ITINERARY button.

A Query is sent to the database to search for all flights reserved for the logged in user name. The ITINENARY page appears and displays all values returned by the database in response to the query.

Page 231: Lr7web Book 04a

Data Parameterization 5-45

5

Exercises

In these exercises, you will determine which fields to parameterize, then add parameters to your Vuser.

Exercise A: Create Vuser to Sign Up New User

Setup 1. Create a new Web Vuser in VuGen.

2. Rename Action1 to RegisterNewUser.Right-click “Action1” in the Actions pane and select “Rename Action” from the pop-up menu. The Action1 label opens for editing.Overwrite “Action1” with RegisterNewUser and press Enter.

3. Start recording into the action RegisterNewUser.If the following URL is not already present in the URL box, then type it in:

http://localhost/servlets/com.mercurytours.servlet.WelcomeServlet

Leave Record the application startup checked, and click OK.

Actions Pane

Tree Pane

Page 232: Lr7web Book 04a

5-46 LoadRunner for the Web 7.0

5

Record 1. Register with the Mercury Tours Web site.

Click the REGISTER link in the Mercury Tours home page. The REGISTER page appears.

2. Rename the Register step to NewUserSignup.

3. Complete the new account information in the browser.Enter values from the table for the fields shown. Leave blank any fields not shown in the table.

4. Finish registering the new user.Click SUBMIT.

5. Rename the com.mercurytours.servlet.RegisterServlet step to NewUserInfo.

Was the sign up successful? What indicates that you have successfully created a new user account with Mercury Tours?

________________________________________________________________________

________________________________________________________________________

6. Insert a checkpoint to verify that a new user account was created.Rename the checkpoint VerifyNewAccount.If you need help completing this step, please refer to Lesson 4.

FIELD VALUE

First Name Steve

Last Name Salvador

Country United States

UserName sal

Password chevy

Confirm Password chevy

Page 233: Lr7web Book 04a

Data Parameterization 5-47

5

7. Navigate to the Mercury Tours welcome page.Click the sign-in link in the “Thank you” message.Wait for the SIGN-ON page to appear.

8. Sign in to Mercury tours using the new user name and password.

Were you able to sign in with new username and password? How can you tell?

________________________________________________________________________

9. Rename the . . . SignonServlet step to FindFlight.

10. Insert a checkpoint called VerifySign-in.

11. Stop recording.

12. Save the Vuser as: \web_project\Vusers\Lab5vuser1

In the VuGen icon tree, what action does the sign-in link step represent?

________________________________________________________________________

Verify Correct Execution 1. Run Lab5vuser1 and accept result1 as the results directory.

2. Review the test results in the Test Results window.

What was the result of the Vuser execution?

________________________________________________________________________

Which step in the execution tree failed?

________________________________________________________________________

Page 234: Lr7web Book 04a

5-48 LoadRunner for the Web 7.0

5

NOTE: If your Test Results showed no failed step, do the following:1. Select Start > Programs > Mercury Tours > Stop Server.2. In Notepad, open the file:...\MercuryTours\Apache Group\Apache\AdminParams.ini

3. Edit the useJavaScript line. Set: useJavaScript = on4. Save the modified file and close Notepad.5. Restart the Apache Server.6. Rerun Lab5vuser1.

What information appears in the Details column of the VerifyNewAccount page of the Test Results?

________________________________________________________________________

________________________________________________________________________

3. Compare Test Results information with the Execution Log.

What error message was displayed in the Execution Log?

________________________________________________________________________

________________________________________________________________________

What was written on the line preceding the error message in the Execution Log?

________________________________________________________________________

________________________________________________________________________

What step preceded VerifyNewAccount in the Test Results window?

________________________________________________________________________

4. In Test Results, click the Web Submit Form: NewUserInfo step.

Page 235: Lr7web Book 04a

Data Parameterization 5-49

5

Was there an error message displayed on the captured page for the Web Submit Form: NewUserInfo step? If yes, what was the message?

________________________________________________________________________

________________________________________________________________________

How could you solve the problem revealed by the error message on the captured Web Submit Form: NewUserInfo page?

________________________________________________________________________

________________________________________________________________________

5. Close the Test Results window and the Run-Time Viewer.

Exercise B: Parameterize Fields with Unique Data Constraints

What is an input field with a unique data constraint?

________________________________________________________________________

________________________________________________________________________

In the RegisterNewUser action, which fields do you think are likely to have unique data constraints?

________________________________________________________________________

Parameterize an Input Field 1. Save Lab5vuser1 as Lab5vuser2.

In the icon tree, which step contains the new user information?

________________________________________________________________________

Page 236: Lr7web Book 04a

5-50 LoadRunner for the Web 7.0

5

2. Open the properties for the step that contains the new user information.Right-click the step NewUserInfo in the VuGen icon tree.Select “Properties” from the pop-up menu. The Submit Form Step Properties dia-log opens with the Data tab displayed.

From the table in the Data tab, write the field name and the value for each field with unique data constraints.

3. Parameterize the userName field.Click the ABC button on the same row as the userName value “sal.” The Select or Create Parameter dialog opens.Type username in the Parameter name box. Accept the default Parameter type “File,” and click Properties. The Parameter Prop-erties dialog box opens.

Create Data File and Add DataWhat is the suggested data file name in the File path box?

________________________________________________________________________

1. Create the data file.Click the Create button.Click OK to dismiss the confirmation message box.

2. Replace the first entry in the data file for the username parameter.Click the Edit button. Notepad opens, displaying the data file username.dat.In Notepad, replace sal with elvis.

FIELD VALUE

Page 237: Lr7web Book 04a

Data Parameterization 5-51

5

Why should you replace “sal” in the data file?

________________________________________________________________________

3. Add the remaining user names from the following table to username.dat.Press Enter after each data item, including the last one.

4. Save the changes, and close Notepad.

What is the value of Select next row in the Parameter Properties dialog? Based on this value, in what order would you expect VuGen to use the data in user-name.dat?

________________________________________________________________________

________________________________________________________________________

5. Click Close to close the Parameter Properties dialog box.

6. Click OK to close the Select or Create Parameter dialog box.

What happened to the value “sal” that was in the userName field in the Submit Form Step Properties dialog?

________________________________________________________________________

Parameterize Another Field 1. Parameterize the password field using password for the Parameter Name.

2. Open the Parameter Properties for password.

USER NAME

elvis

fred

carl

Page 238: Lr7web Book 04a

5-52 LoadRunner for the Web 7.0

5

What is the suggested data file name in the File path box?

________________________________________________________________________

3. Create a data file for password and open it for editing.

4. Replace chevy with shoes in the data file password.dat.Follow the same procedure you used to create a file and add data for username.

5. Add the remaining passwords from the table to the data file password.dat.

6. Close Notepad and save the changes to password.dat.

7. Ensure that dependent values are matched.Pick “Same line as username” from the Select next row list.

8. Close the Parameter Properties dialog and the Select or Create Parameter dialog when you have finished.

Parameterize a Field Using Existing ParameterRefer to the Submit Form Step Properties dialog. Which field uses the same data as the password field?

________________________________________________________________________

1. Parameterize the confirmPassword field using an existing parameter.Click the ABC icon on the confirmPassword row.Click the down-arrow to open the Parameter name list in the Select or Create Parameter dialog box.Select “password” from the Parameter name list and click OK.

PASSWORD

shoes

wilma

seti

Page 239: Lr7web Book 04a

Data Parameterization 5-53

5

Was the parameter “password” assigned to the field confirmPassword?

________________________________________________________________________

2. Parameterize firstName and lastName.Use data from the table.

3. Return to the VuGen main window.Click OK to close the Submit Form Step Properties dialog.

Verify Correct Execution 1. Change the Run-Time Settings to run the Vuser 3 times, to show parameter val-

ues in the Execution Log, and to verify checkpoints.Make sure that the settings agree with those in the following table. Do not change other settings that are not in the table. Click OK to save any changes.

2. Save, then run Lab5vuser2, accepting the default results directory.

3. Review the execution results.

firstName lastName

Elvis Presley

Fred Flintstone

Carl Sagan

TAB SETTINGS

Pacing Set Number of Iterations to 3

Log Check Extended log and Parameter substitution.

Preferences Check Verification checks

Page 240: Lr7web Book 04a

5-54 LoadRunner for the Web 7.0

5

Did the Vuser iterate successfully? What were the results of each iteration in the Test Results window?

________________________________________________________________________

________________________________________________________________________

Was a new user name created for each iteration? (HINT: Look at the captured NewUserInfo page for each iteration.)

________________________________________________________________________

4. Review the Execution Log.

Did the Execution Log list the parameters you created and the values for each parameter during each iteration?

_______________________________________________________________________

5. Close the Run-Time Viewer and the Test Results window.

Exercise C: Parameterize to Avoid Server Caching

Setup 1. Open \web_project\Vusers\Lab4vuser1.

NOTE: If you were not able to complete the exercise that created Lab4vuser1, open \web_project\Solutions\_Lab4vuser1 instead.

2. Save the Vuser as: \web_project\Vusers\Lab5vuser3

3. Parameterize the userName and password fields for the FindFlight step, then close the Submit Data Step Properties dialog. DO NOT ADD THE DATA YET.Follow the same procedure you used to parameterize these fields in the previous exercise, then close Submit Form Step Properties without adding any data.

Page 241: Lr7web Book 04a

Data Parameterization 5-55

5

Use One Data File for 2 ParametersIn the previous exercise you created separate data files for each parameter. In this section you will create one data file that works for two parameters.

1. Open the Parameter List dialog box.Click the Open parameter list toolbar button, or select Vuser > Parameter List.

2. Create a data file called sign-in.dat.Select “username” from the list in the left pane of the dialog box.In the File path box, overwrite “username.dat” with sign-in.dat.Click the Create button. A data column, username, with one row of data, “jojo”, appears in the frame below the File path box.

3. Associate the password parameter with sign-in.dat.Select “password” from the list in the left pane of the dialog box.Click the down-arrow button at the right end of the File path box and select “sign-in.dat” from the list.

4. Add a second column to sign-in.dat for the passwords.Click the Add Col. button. The Add New Column dialog box opens with pass-word already entered in the Column name box.Click OK. A second column called password is added to sign-in.dat. The first data row contains the value “bean”.

5. Check the column associations.When you select a parameter from the left pane, the value in the By number box should change. Make sure that “username” is associated with column 1, and “password” with column 2 of sign-in.dat.

Page 242: Lr7web Book 04a

5-56 LoadRunner for the Web 7.0

5

6. Add more data for both parameters to sign-in.dat.Click the Edit button.Notepad opens sign-in.dat showing the column headings “username,pass-word” on line 1 and the first row of data “jojo,bean” on line 2.Starting on line 3, add each username and password (separated by a comma) from the table to a new line of sign-in.dat. Do not add a space after the comma. Press Enter after each line (including the last line).Close Notepad and save the changes when you have finished.

7. Ensure that dependent values are matched.Highlight “password” in the parameter list, and pick “Same line as username” from the Select next row list.

8. Close the Parameter List dialog box and save the Vuser.

Verify Correct Execution 1. Verify and configure the Run-Time Settings.

Verify that the settings agree with those in the following table. Change any setting that does not agree with the table. Do not change other settings that are not in the table. Click OK to save any changes.

2. Run Lab5vuser3, accept the default results directory, and click OK.

USER NAME PASSWORD

elvis shoes

fred wilma

carl seti

TAB SETTINGS

Pacing Set Number of Iterations to 4

Log Select Extended logCheck Parameter substitution

Preferences Check Verification checks

Page 243: Lr7web Book 04a

Data Parameterization 5-57

5

3. Review the test results.

Did the Vuser iterate successfully 4 times?

________________________________________________________________________

Did a different Vuser sign in each iteration?

________________________________________________________________________

4. Close the Run-Time Viewer and the Test Results window after you have fin-ished reviewing the results.

Exercise D: Parameterize a Text Check

In this exercise you will use the Lab5vuser3 script again. You will add a text check to the already parameterized username and password fields.

In what situation would you want to parameterize a text check?

________________________________________________________________________

________________________________________________________________________

1. Open Lab5vuser3 and save it as Lab5vuser4.

NOTE: If you were unable to complete Lab5vuser3 successfully, you can use \web_project\solutions\_Lab5vuser3.

2. Parameterize the creditnumber field in the ConfirmFlight step.Use cardnumber for the Parameter name.

Page 244: Lr7web Book 04a

5-58 LoadRunner for the Web 7.0

5

3. Add more card numbers from the table to the data file cardnumber.dat.

4. Ensure that dependent values are matched.Pick “Same line as username” from the Select next row list.

5. Close all open dialogs when you have finished.

6. Add a text check to the parameterized ConfirmFlight step.Right-click the ConfirmFlight step in the icon tree.Select “Insert After” from the pop-up menu. The Add Step dialog box opens.Expand Web Checks, select “Text Check,” and click OK. The Text Check Proper-ties dialog box opens.

7. Set the text check to find the cardnumber value.Click the ABC icon at the right of the Search for box. The Select or Create Parameter dialog box opens.Click the down-arrow at the right of the Parameter name box.Select “cardnumber” from the list, and click OK to close the dialog.

8. Rename the text check from web_find to VerifyCardNumber.Click the General tab.Replace “web_find” with VerifyCardNumber in the Step Name box.Click OK to save the changes and to close the Text Check Properties dialog.

9. Save, then run Lab5vuser4.Accept the default results directory and click OK.

Did the cardnumber text check pass for each iteration?

________________________________________________________________________

CARD NUMBER

2345678

13579

24680

Page 245: Lr7web Book 04a

Data Parameterization 5-59

5

10. Close the Test Results window, the Run-Time Viewer, and Lab5vuser4 when you have finished.

Exercise E (Optional): Database Issues

1. Open, then run Lab5vuser2 again.

What were the results of the run?

________________________________________________________________________

Why did the run fail each time?

________________________________________________________________________

________________________________________________________________________

One way to avoid the problem encountered in this exercise is to create unique data for every script run. What is a better way to avoid the problem?

________________________________________________________________________

2. Close the Test Results window, the Run-Time Viewer, and all open Vusers.

Page 246: Lr7web Book 04a

5-60 LoadRunner for the Web 7.0

5

Review Questions

Validate your understanding of this lesson by answering the following questions:

1. Why do you need to parameterize fields in your Vuser scripts?

________________________________________________________________________

________________________________________________________________________

2. List the reasons why parameterization is necessary when load testing the Web server and the database server.

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

3. Who is the person on the project team who can give you valid data necessary for Vusers with parameterized fields?

________________________________________________________________________

4. How can data caching have a negative effect load testing results?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 247: Lr7web Book 04a

Part 2: Web Scenarios & Analysis

Page 248: Lr7web Book 04a
Page 249: Lr7web Book 04a

Manual Scenarios 6-1

Manual Scenarios

Page 250: Lr7web Book 04a

6-2 LoadRunner for the Web 7.0

6

2

• The elements that make up a LoadRunner scenario

• The different types of scenarios

• How to create and run a manual scenario• How to use LoadRunner analysis tools to locate

trouble spots in the application under test

• How to adjust Run-Time Settings to help achieveyour load test goals

��!������

In this lesson, you will learn:

Page 251: Lr7web Book 04a

Manual Scenarios 6-3

6

Introduction to Scenarios

Page 252: Lr7web Book 04a

6-4 LoadRunner for the Web 7.0

6

4

&��������'�� �� �����������

#�� ,� ���� ���

DEFINITION

An environment which describes allthe elements to be used and theconditions under which you want totest your system.

Page 253: Lr7web Book 04a

Manual Scenarios 6-5

6

5

�� ����0���� ��

LOAD GENERATOR

Vuser Scriptstart transactionsend URL1receive web pageend transactionimage checkpoint

VUSER SCRIPT

Response time not to exceed 7 seconds

GOAL MONITORS

• Hits/sec• Pages/sec• HTTP re-

sponse/sec

RUN-TIME SETTINGS

• Disable logging• Disable think times• Enable checks

EXAMPLES

Page 254: Lr7web Book 04a

6-6 LoadRunner for the Web 7.0

6

6

����#�� ,� ���� �����

• Before scenario execution– creates scenario– starts scenario

Controller organizes & manages scenario elements

• During scenario execution– runs many Vusers simultaneously– controls each Vuser (initialize, run,

pause, stop)– displays execution status of each Vuser– displays messages from each Vuser– monitors server and network resources

• After scenario execution– collects and organizes performance data– launches the Analysis tools

Page 255: Lr7web Book 04a

Manual Scenarios 6-7

6

7

����������#�� ��� ����%• Vusers create the load

• Load generators are computers which run the Vusers

LOAD GENERATORS

6&(1$5,2��

&RQWUROOHU

9XVHUV 9XVHUV

,QWHUQHW

:HEVHUYHU

:HEVHUYHU

,QWHUQHW

9XVHUV

&RQWUROOHU

6&(1$5,2��

LOAD GENERATOR

• Manyarrangementsare possible

EXAMPLES

Page 256: Lr7web Book 04a

6-8 LoadRunner for the Web 7.0

6

8

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

See flowchart on next slide

Page 257: Lr7web Book 04a

Manual Scenarios 6-9

6

9

�������� ����@��������

*OPTIONAL

Selectscenario

typeMANUAL GOAL

selectscript

editschedule*

editgoal

add group*

add vusers

select load generators

select monitor options*

selectmonitors*

select run-time settings

selectscript

set rendezvouspolicy*

Page 258: Lr7web Book 04a

6-10 LoadRunner for the Web 7.0

6

10

CREATE SCENARIO—OVERVIEW

�������� ��������

Choose oneof thesetypes whenyou start anew scenario:

• Manual• Goal-

Oriented

Page 259: Lr7web Book 04a

Manual Scenarios 6-11

6

11

• Manual– main purpose is to learn how many Vusers

can run concurrently– gives you manual control over how many

Vusers run and at what times

• Goal-Oriented– goal may be throughput, response time, or

number of concurrent Vusers– LoadRunner manages Vusers automatically

CREATE SCENARIO—OVERVIEW

�� ������)�����<��� ��

Page 260: Lr7web Book 04a

6-12 LoadRunner for the Web 7.0

6

12

CREATE SCENARIO—OVERVIEW

� �-��������.�/

• Select one ormore itemsfrom AvailableScripts list

• Browse formore scripts

• Find script in aTestDirector*project

• Record a newscript

Options:

*TestDirector is Mercury Interactive’s integrated test management tool

Page 261: Lr7web Book 04a

Manual Scenarios 6-13

6

Manual Scenarios

Page 262: Lr7web Book 04a

6-14 LoadRunner for the Web 7.0

6

14

CREATE MANUAL SCENARIO

� ������

• Select a script• Edit the Group Name• Change the number

of Vusers

• Click Add Group toopen the Add Groupdialog

Page 263: Lr7web Book 04a

Manual Scenarios 6-15

6

You can include different types of Vusers in a scenario so that different business processes are run within the same scenario. One way to accom-plish that is to set up a group for each Vuser script you want to include in the scenario. For example, you could add Create order, Update order and Ship order groups to a scenario called Order Processing, to emulate real user Web site activity.

The advantage to this type of scenario implementation is that you can con-trol the number of processes through the system. If you want to scale up the number of Create Order transactions by 20%, then you just run more of those Vusers in the scenario.

15

CREATE MANUAL SCENARIO

0 ��������� "������

• Select a script row andclick Details.

• Edit Group Name, VuserQuantity, Load Generator

• Check the script Type

• Click More to see Vusers,Files, & Rendezvous

Page 264: Lr7web Book 04a

6-16 LoadRunner for the Web 7.0

6

16

0 ������ ����.����� ��/

Click Edit Schedule to open Schedule Builder

Page 265: Lr7web Book 04a

Manual Scenarios 6-17

6

17

RAMP UP TAB

EDIT SCHEDULE

��� ����4��� �;,����'�����

• Schedule by Scenario orby Group

• Control Vuser ramp up– load all Vusers at once– specify how many to

load and how often

Page 266: Lr7web Book 04a

6-18 LoadRunner for the Web 7.0

6

18

EDIT SCHEDULE

��� ����4��� �; 8����� ����

DURATION TAB

Control scenario duration• Run until all Vusers finish• Run for a certain length

of time

Page 267: Lr7web Book 04a

Manual Scenarios 6-19

6

19

CREATE MANUAL SCENARIO

� �A��� "�����#�� ��� ����.�/

1. Add loadgeneratorsfor thescenario

2. Select loadgeneratorfor eachgroup

Page 268: Lr7web Book 04a

6-20 LoadRunner for the Web 7.0

6

20

CREATE MANUAL SCENARIO

8�"� ��,� �������+�����.����� ��/

• Rendezvous settings are accessible only forscripts which already include a rendezvous

• Open from menu: Scenario > Rendezvous

When to release Vusers

Maximum time Vusers wait

to be released

Enable/disable

rendezvousEnable/disableVusers

Page 269: Lr7web Book 04a

Manual Scenarios 6-21

6

21

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

4.1 Set Monitoring Options

4.2 Select & Configure Monitors

4.3 Choose Run-Time Settings

4.4 Run

Page 270: Lr7web Book 04a

6-22 LoadRunner for the Web 7.0

6

22

RUN SCENARIO—OVERVIEW

������,� � ���� ����

• When scenario starts running, Vuser groupsare assigned to their load generators andexecute their scripts

• LoadRunner– records duration of defined transactions– performs any rendezvous in the scripts– collects error and notification messages

generated by Vusers

Page 271: Lr7web Book 04a

Manual Scenarios 6-23

6

23

RUN MANUAL SCENARIO

,� ����

Vuser groups

Select monitors from list

• Add monitors and watch them in real time• Watch scenario progress in real time

Scenariostatus

Page 272: Lr7web Book 04a

6-24 LoadRunner for the Web 7.0

6

24

RUN MANUAL SCENARIO

������ ���� ������� �

In the Monitors tab:• Check Enable Transaction Monitor• Select Send errors to the output window

Page 273: Lr7web Book 04a

Manual Scenarios 6-25

6

LoadRunner offers monitoring tools which provide means to track how the system is coping with load. For example, LoadRunner’s Server Resource Monitor not only gives you access to all the Windows NT counters used by the NT Performance Monitor, but also saves its measure-ments in the results database. That enables the LoadRunner Analysis win-dow to display graphs of the NT counters.

25

RUN MANUAL SCENARIO

�������� �����.����� ��/

• Drag item from list to a graph window

• Double-click a graph window to enlarge it

Page 274: Lr7web Book 04a

6-26 LoadRunner for the Web 7.0

6

26

�� "������� ����

For monitors fromthese categories:

Do this:1. Right-click a monitor pane

2. Select "Add Measure-ment(s)" from pop-up menu

3. Select machines andresources to monitor fromthe dialog

• Database ServerResource

• Firewalls• Network Delay• Streaming Media• System Resource• Web Application

Server• Web Server Resource

127(��$GPLQLVWUDWLYH�SULYLOHJHV�DUH�UHTXLUHG�WR�FRQILJXUH�WKHVH�PRQLWRUV

Page 275: Lr7web Book 04a

Manual Scenarios 6-27

6

27

�� "������� ����

1. Right-click a monitor pane2. Select "Add Measurement(s)" from pop-up menu

Page 276: Lr7web Book 04a

6-28 LoadRunner for the Web 7.0

6

29

�� "������� ���;*����2�8����

3. Select the machines to monitor from the dialogs

Page 277: Lr7web Book 04a

Manual Scenarios 6-29

6

Initializing a Vuser group distributes the Vusers in the group to their des-ignated load generators so that they are ready to execute their script(s). By initializing all of the Vusers in a group before running them, you can ensure that they all begin executing the scenario at the same time.

30

�� ����� ��-����

• Initializeinitializesselected Vusers

Select group • Run buttons runselected Vusers

• Start Scenarioruns all Vusers

• Vusers opensVusers dialog

Filter Vusersby status

Page 278: Lr7web Book 04a

6-30 LoadRunner for the Web 7.0

6

31

�� ����� ��-����

Details opens the Vuser Information dialog

Page 279: Lr7web Book 04a

Manual Scenarios 6-31

6

32

�� ����01����� �+����

4.1 Verify that Vusersrun concurrently

Verify that parameterized dataworks under concurrent usage

3-5

Objective Purpose # of Vusers

Page 280: Lr7web Book 04a

6-32 LoadRunner for the Web 7.0

6

Run-Time Settings are saved with the test in VuGen but can be overridden with changes in the Controller.

■ Disable logging is the default in the Controller

■ Standard log is the default in VuGen

33

4.1 VERIFY THAT VUSERS RUN CONCURRENTLY

,� <���������� ��;#��

• Use logs to helpdebug a scenario

– SelectExtended log

– CheckParametersubstitution

• Vuser output willbe blank unlesslogging isenabled

Page 281: Lr7web Book 04a

Manual Scenarios 6-33

6

34

-�����������#��

Vuser number

• Open the Output Logs forthe Vusers which haderrors

• Can be included in log:– error messages– parameter substitution– transaction statuses– verification statuses

• LoadRunner produces loginformation for each Vuserwhen logging is enabled

Page 282: Lr7web Book 04a

6-34 LoadRunner for the Web 7.0

6

35

�� ����01����� �+����

4.2 Isolate Top Timetransactions

Isolate transactions that haveperformance problemsirrespective of load

20%

4.1 Verify that Vusersrun concurrently

Verify that parameterized dataworks under concurrent usage

3-5

Objective Purpose # of Vusers

Page 283: Lr7web Book 04a

Manual Scenarios 6-35

6

36

&��������'�� �� �����������

����������� �����

DEFINITION

A LoadRunner transaction whichrequires significantly longer to completethan other transactions,* irrespective ofload.

* In this definition, "other transactions" excludesthose which measure an entire business process.

Page 284: Lr7web Book 04a

6-36 LoadRunner for the Web 7.0

6

37

4.2 ISOLATE TOP TIME TRANSACTIONS

,� ���������� ��;��� 2�����

Select Ignore –Think timesmight make itmore difficult tofind top timetransactions

Page 285: Lr7web Book 04a

Manual Scenarios 6-37

6

■ Run Vusers as a thread unless your operating system does not support multi-threading (e.g., Windows 95).

■ Use Automatic Transactions for each step if response times are too slow. Measuring each step might help to locate bottlenecks.

NOTE: At the tester’s option, VuGen can add the action name and line number to the name of each automatic transaction for a step. Toggle that option on and off in the Preferences tab of the Run-Time Settings dialog.

38

4.2 ISOLATE TOP TIME TRANSACTIONS

,� ���������� ��;�� ���

Check Define each step as a transaction

• Automaticallymeasures eachstep

• Makes it easierto find top-timetransactions

Page 286: Lr7web Book 04a

6-38 LoadRunner for the Web 7.0

6

39

4.2 ISOLATE TOP TIMETRANSACTIONS

�� ����� ,���� ������

Transactionsmeasuringentire businessprocesses canbe filtered out

Top timetransactions

Page 287: Lr7web Book 04a

Manual Scenarios 6-39

6

40

�� ����01����� �+����

4.3 Run full load test Verify that the system functionsunder the expected load

100%

4.2 Isolate Top Time transactions

Isolate transactions that haveperformance problemsirrespective of load

20%

4.1 Verify that Vusersrun concurrently

Verify that parameterized dataworks under concurrent usage

3-5

Objective Purpose # of Vusers

Page 288: Lr7web Book 04a

6-40 LoadRunner for the Web 7.0

6

41

4.3 RUN FULL LOAD TEST

,� <���������� ��;#��

Select Disable logging

Logging:

• Consumesresources

• Not neededafter script isdebugged

Page 289: Lr7web Book 04a

Manual Scenarios 6-41

6

■ Replay think time as recorded is the default in the Controller

■ Ignore think time is the default in VuGen

42

4.3 RUN FULL LOAD TEST

,� <���������� ��;��� 2�����

• Ignore thinktime to achievegreaterthroughput

• Replay thinktime to emulatereal users (butyou might wantto limit them)

Page 290: Lr7web Book 04a

6-42 LoadRunner for the Web 7.0

6

43

EnableVerificationchecks to verifyfunctionalityunder load

4.3 RUN FULL LOAD TEST

,� ���������� ��;+�"�� ��

Page 291: Lr7web Book 04a

Manual Scenarios 6-43

6

44

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

5.1 Check Analysis Summary

5.2 Open Appropriate Graphs

Page 292: Lr7web Book 04a

6-44 LoadRunner for the Web 7.0

6

45

4.3 RUN FULL LOAD TEST

���2�� �������������• The 1st page you see

after a run includes:– total transactions

passed / failed

– specific transactionspassed / failed

• Click a link to go to theassociated graph

• AutomaticAND user-definedtransactionsappear inthe AnalysisSummaryand graphs

Page 293: Lr7web Book 04a

Manual Scenarios 6-45

6

46

��� ���*�������

Page 294: Lr7web Book 04a

6-46 LoadRunner for the Web 7.0

6

47

�����.���+�,�>�����/�������

Page 295: Lr7web Book 04a

Manual Scenarios 6-47

6

48

�� ����01����� �+����

4.4 Run "overdrive test" Verify the scalability of thesystem by running more than100% load

100% +

4.3 Run full load test Verify that the system functionsunder the expected load

100%

4.2 Isolate Top Timetransactions

Isolate transactions that haveperformance problemsirrespective of load

20%

4.1 Verify Vusers run concurrently

Verify parameterized data worksunder concurrent usage

3-5

Objective Purpose # of Vusers

Page 296: Lr7web Book 04a

6-48 LoadRunner for the Web 7.0

6

49

4.4 RUN OVERDRIVE TEST

�����������������"�������

• Determine whether your system is scalable forincreased load

• Determine the limit of load that can be handledbefore more resources are required

• Use the same run-time settings and analysis toolsas for a full load test

• Use cross result graphs to compare scenario runsfor different loads

Page 297: Lr7web Book 04a

Manual Scenarios 6-49

6

50

�����,�����������

• Compare the same scenario before and aftersystem tuning

• Compare heavier load with lighter load to see howperformance was affected

Page 298: Lr7web Book 04a

6-50 LoadRunner for the Web 7.0

6

51

�����,�����������

RESPONSE

TI

ME

higher

lower

heavier load

lighter load

heavier load

lighter load

Page 299: Lr7web Book 04a

Manual Scenarios 6-51

6

52

�����,�����������

• Each circledpair is sametransactionunderdifferent loads

• Heavier loadis the rightmember ofeach pair

Page 300: Lr7web Book 04a

6-52 LoadRunner for the Web 7.0

6

53

�����,�����������

lower - RESPONSE TIME - higher

Heavier loadis clustered atthe high end

Page 301: Lr7web Book 04a

Manual Scenarios 6-53

6

54

�����,�����������

Comparetransactions persecond for lightervs. heavier load

FlightPurchase:25vusers

FlightPurchase:30vusers

Page 302: Lr7web Book 04a

6-54 LoadRunner for the Web 7.0

6

55

������

• The Controller manages the scenario elements

• A load generator is a machine on which Vusers run

• Scenarios may be manual or goal-oriented

• Some monitors require that you add measurementsto them in order to generate data

• Merge graphs to see how different scenarioelements affect each other

Page 303: Lr7web Book 04a

Manual Scenarios 6-55

6

Exercises

Exercise A: Create and Run a Manual Scenario

Setup 1. Write down the network name of your computer.

Write your network computer name: ______________________________________

To get your network computer name:

■ Windows NT—Right-click the Network desktop icon and select “Properties” from the pop-up menu. The machine name appears in the Properties dialog.

■ Windows 2000—Right-click the MyComputer desktop icon and select “Prop-erties” from the pop-up. Click the Network Identification tab to see the name.

■ If you cannot get your network computer name that way, use localhost instead.

2. Start the Windows Task Manager program.Right-click the Windows task bar and select “Task Manager.”

3. Make sure the Apache Web Server is running.

Start 1. Invoke the Controller and maximize it.

From the Windows Start menu, select “Controller” from the LoadRunner pro-gram group.

2. Create a new manual scenario.If the New Scenario dialog did not appear automatically after you invoked the Controller, select File > New or click the Create a new scenario button to open it.In the Select Scenario Type frame select Manual Scenario.

Page 304: Lr7web Book 04a

6-56 LoadRunner for the Web 7.0

6

3. Add the Lab5vuser4 script to the scenario.Select “Lab5vuser4” from the Available Scripts list and click the Add button.If Lab5vuser4 is not in the list, click Browse and navigate to \web_project\Vus-ers to find it. (If you did not complete the exercise that created Lab5vuser4, select \web_project\solutions\_Lab5vuser4 instead.Click OK. The Controller Design tab opens, displaying the Scenario Schedule and Scenario Groups panes.

NOTE: In this exercise we won’t schedule the scenarios. In a real load testing situ-ation, you might want to use the Schedule Builder to achieve your test objectives.

4. Verify the script Type.Click the Details button. The Group Information dialog opens.

What is the script Type?

________________________________________________________________________

5. Rename the group to Lab6.Overwrite the text in the Group Name box with Lab6.

6. Increase the number of Vusers to 25.In the Vuser Quantity box, overwrite the default 10 with 25.Click OK to close the Group Information dialog.

Add and Configure Load Generator 1. Add a Load Generator to the scenario.

Click the Generators button. The Load Generators dialog box opens.Click the Add button. The Add Load Generator dialog box opens.In the Name box, type the machine name you wrote down in the “Setup” section of Exercise A.In the Platform list box select Windows and click OK.

2. Connect to the Load Generator.Select the machine that you just added and click the Connect button.Make sure that the load generator Status changes to “Ready,” then click Close.

Page 305: Lr7web Book 04a

Manual Scenarios 6-57

6

3. Assign the Load Generator to the Lab6 group.Click the cell in row 1 of the Load Generators column (the current value of that cell should be “localhost”).Open the list and select the load generator that you just connected to.

Adjust Settings and Options 1. Select the Run-time Settings.

Click the Run-Time Settings button. Verify that the Run-Time Settings agree with those in the following table. Change any setting that does not agree with the table. If there is no row in the table for a setting, leave it as is.

* Vusers running as threads use fewer system resources than when running asprocesses. Do not check if running Win 95 or Win 98.

2. Click OK to save any changes and close the Run-Time Settings dialog.

3. Save all messages.Select Tools > Options. The Options dialog box opens.Click the Output tab and verify that Save all messages is selected.Click OK to close the Options dialog box.

TAB SETTINGS

Pacing Enter 4 in Number of Iterations edit box.

Log Select Extended log.Check Parameter substitution.

Think Time Select Replay think time.Select As recorded.Check Limit think time to and enter “3” in the seconds box.

Preferences Check Verification checks.Uncheck File and line in automatic transaction names.

General Uncheck Continue on error.Select Run Vuser as a thread. (Win 2000 or NT only)*Check Define each action as a transaction.Check Define each step as a transaction.

Page 306: Lr7web Book 04a

6-58 LoadRunner for the Web 7.0

6

Why do you want to save all messages?

________________________________________________________________________

4. Save the scenario as: \web_project\Scenarios\Lab6_manual.lrs

Add and Configure Monitors 1. Add the Throughput Web Resources monitor.

Click the Run tab at the bottom of the Controller’s main window.In the list of graphs (just below the Scenario Groups grid) click the “+” next to Web Resource Graphs to expand the graph tree.Select “Throughput” and drag it into a pane of the graph view area.

2. Add the default measurements for the Windows Resources monitor.If the Windows Resources Monitor is not already visible, expand System Resource Graphs, select Windows Resources, and drag it to one of the graph panes.Right-click the Windows Resources graph and select “Add Measurement(s)” from the pop-up menu. The Windows Resources dialog opens.Click the Add button in the Monitored Server Machines frame. The Add Machine dialog opens.Type the Load Generator’s name in the Name edit box.Choose the correct version of Windows from the Platform list, then click OK to close the Add Machine dialog.In the Resource Measurements on: frame you will see the default measurements for this monitor.Click OK to close the Windows Resources dialog and start the monitor.

3. Familiarize yourself with the monitor information.Double-click the Windows Resources graph pane to enlarge it.Notice that each measurement appears on a color-coded row in the bottom pane of VuGen’s main window. Each row corresponds to a line in the graph of the same color. Selecting a row highlights the corresponding line in the graph, and vice versa.

Page 307: Lr7web Book 04a

Manual Scenarios 6-59

6

Who would you consult for advice on which Windows NT counters to set?

________________________________________________________________________

What is the benefit of having the Windows Resources Monitor?

________________________________________________________________________

4. Add the Apache Web Server Resource monitor.Double-click the Windows Resources graph to reduce it and to bring the other graph panes back into view.Select “Apache” from the Web Server Resource Graphs and drag it into the graph view area.

5. Add the load generator to the Apache Monitor.Right-click the Apache graph pane and select "Add Measurement(s)" from the pop-up menu. The Apache dialog opens.Click the Add button in the Monitored Server Machines frame.Type the Load Generator’s name in the Name box in the Add Machine dialog.Choose the correct version of Windows from the Platform list.Click OK to close the Add Machine dialog.

6. Add measurements to the Apache Monitor.Click the Add button in the Resource Measurements on: frame.The Apache - Add Measurements dialog opens.Select an item from Available Measurements.Type /server-status?auto in the URL box if it’s not already there.Click OK to add the item.Repeat this step until all 5 measurements have been added.Click OK to close the Apache dialog and start the monitor.

Page 308: Lr7web Book 04a

6-60 LoadRunner for the Web 7.0

6

Preliminary Runs 1. Specify the result file: \web_project\Results\Lab6_2vusers.

Select Results > Results Settings. The Set Results Directory dialog box opens.Type Lab6_2vusers in the Results name box. If \web_project\Results is not the default directory, then click Browse and select it.Click OK to close the Set Results Directory dialog box.

2. Open the Vusers window.In the Run tab, click the Vusers button. The Vusers dialog box opens.

3. Run 2 Vusers to see if you can.Select 2 rows in the Vusers window and click the Run button.Wait for the Vusers’ statuses to change to “Done.”

4. If both Vusers finished the run without an error, reset the Vusers to “Down” status.In the Run tab click the Reset button. All Vusers’ statuses should change to Down.If the run produced any errors, consult the instructor to correct the problem.

5. Run 5 Vusers and set the Results directory to \web_project\Results \Lab6_5vusers.

Select Results > Results Settings.

6. Check Vuser output for anomalies.Right-click any row in the Vuser window and select “Show Vuser Log” from the pop-up menu. The Vuser output windows open.Scan the text for iteration numbers, parameter substitutions, and verification sta-tuses.

■ Iterations should be clearly defined.

■ Parameter substitutions should show different values for each iteration.

■ Web_find statements should say “successful.”

■ Transactions should show a Pass status.

■ The word “Error” should not appear.

Page 309: Lr7web Book 04a

Manual Scenarios 6-61

6

If you see no errors or other problems, close all 5 Vuser output windows (they are stacked on top of each other) and proceed to the next step. Otherwise, consult the instructor about how to proceed.

If you prefer, you can open the log in Notepad so that you can use Notepad’s Search feature. The files are \web_project\results\Lab6_5vusers\Lab6_1.log for Vuser 1, Lab6_2.log for Vuser 2, etc.

Find Top Time Transactions 1. Click the Analyze Results toolbar button and wait for the Analysis Summary to

appear.

2. Display the Transaction Response Time - Average graph.Click the Transaction Response Time - Average tab.If that tab does not appear in your Analysis window, click the Add Graph toolbar button to open the Open a New Graph dialog.Expand the Transactions category and select “Transaction Response Time - Aver-age” from the list.Click the Open Graph button, then close the dialog after the graph appears.

Which transaction had the highest average response time? (HINT: Click a line in the graph to highlight the corresponding row in the grid below.)

________________________________________________________________________

3. Filter out the BookFlight_Transaction from the graph.Uncheck the box next to BookFlight_Transaction in the grid.

Why should you remove BookFlight_Transaction from the graph when looking for top time transactions?

________________________________________________________________________

________________________________________________________________________

TIP

Page 310: Lr7web Book 04a

6-62 LoadRunner for the Web 7.0

6

Does the graph show any spikes now? If yes, which transaction(s) caused the spikes?

________________________________________________________________________

4. Save the Analysis session as: \web_project\Results\Lab6_5vusers \res1.lra

5. Close the LoadRunner Analysis window.

Exercise B: Load Testing

Run Full Load TestNOTE: The graphs and questions in this section are intended to be suggestive, not prescriptive. As you become more familiar with LoadRunner’s analysis tools and with load testing, you may find other tools and questions useful as well.

NOTE: During this exercise, you should check the Windows Task Manager occa-sionally to make sure that your machine does not run out of resources. If it does, stop the scenario and scale down the number of Vusers that you run to a number that does not consume all of the computer’s resources.

1. Verify that Results > Auto Load Analysis is selected.

LoadRunner can automatically create a results database and display the Analysis window. If Auto Analysis is not enabled, you can select Results > Analyze Results from the menu to perform those actions after a scenario has finished running.

2. Set the results directory to Lab6_20vusers.

3. Disable logging in the Run-Time Settings.

4. Reset the Vusers.

TIP

Page 311: Lr7web Book 04a

Manual Scenarios 6-63

6

5. Initialize 20 Vusers.In the Vusers window, highlight the first 20 Vusers and click the Initialize button on the Controller’s toolbar.Wait for the Vusers’ Statuses to change to Ready.

6. Run the Vusers and watch the Apache monitor.Click the Run button in the Vusers window (or on the Controller’s toolbar). The Vusers’ Statuses should change to Running.Click the Close button to close the Vuser dialog box.Double-click the Apache monitor to enlarge it. Make sure that data is appearing on it. If not, there may be a problem with your httpd.conf file.

NOTE: If data does not appear on your Apache monitor graph,1. Stop the scenario run.2. Run the Stop Server program in the Mercury Tours program group.3. In Notepad, open the file: \MercuryTours\Apache Group\Apache\Conf

\httpd.conf

4. Find the following line:#LoadModule status_module modules mod_status.so

5. Delete the “#” character.6. Delete # from the line: #ExtendedStatus On 7. Also delete the “#” character from these lines:

#<Location /server-status>

#SetHandler server-status

#</Location> [the first line where this occurs after SetHandler server-status]8. Save the changes and close Notepad.9. Restart the Apache server.

Analyze Results 1. Check the Transaction Summary.

When LoadRunner has finished processing the results data, it displays the Analy-sis Summary. Look at the Transaction Summary.

How many passed and failed transactions does the Transaction Summary show? What percentage of all transactions failed?

________________________________________________________________________

Page 312: Lr7web Book 04a

6-64 LoadRunner for the Web 7.0

6

2. Open the Apache graph (from the Web Server Resources category).

3. Compare Busy Servers and Idle Servers in the Apache graph.Hold down the Shift key, then, in the grid below the Apache graph, click the rows #Busy Servers (Apache) and #Idle Servers (Apache).

What do you notice about the Busy and Idle Servers lines in the Apache graph?

________________________________________________________________________

4. Display the Transaction Response Time - Average graph.

5. Filter out the action transaction.In the grid below the graph, uncheck BookFlight_Transaction.

What do you notice about the graph now?

________________________________________________________________________

6. Save the session and close the Analysis window when you are finished.Save the session as: \web_project\Results\Lab6_20vusers\res1

NOTE: If you were conducting a real load test on your system, at this point you would analyze the test results and report your findings to the system experts. They should then tune the system to optimize it for 100% load. We won’t be tun-ing systems in this course so we continue with the next scenario.

Run “Overdrive” TestWhat is a reason to scale the load from 20 to 25 Vusers?

________________________________________________________________________

________________________________________________________________________

1. Specify the result file: \web_project\Results\Lab6_25vusers

Page 313: Lr7web Book 04a

Manual Scenarios 6-65

6

2. Reset the Vusers.

3. Initialize and run 25 Vusers, and wait for them to finish.

Compare Full Load and Overdrive Results 1. Create cross result graphs.

In the Analysis window, select File > Cross with Result. The Cross Result dialog opens with Lab6_25vusers.lrr already in the list.Click the Add button. The Open Result File for New Analysis Session dialog opens.Navigate to \web_project\Results\Lab6_20vusers, select the file Lab6_20vusers.lrr, and click Open.Click OK to close the Cross Result dialog. LoadRunner creates a new database.Click No if you see a message asking if you want to open the default graphs.

2. Open the Transaction Response Time - Average graph.

3. Filter the transactions of the Transaction Response Time - Average graph. In the grid below the graph, uncheck the boxes for all transactions except the ones in the table below.Fill in the average transaction response times.

AVERAGE TRANS. RESPONSE TIMES

TRANSACTION 20VUSERS.LRR 25VUSERS.LRR

ConfirmFlight

FindFlight

PurchaseFlight (automatic)

purchase_flight (manual)

SelectFlight

Page 314: Lr7web Book 04a

6-66 LoadRunner for the Web 7.0

6

How much did the average transaction response time vary as more Vusers were added?

________________________________________________________________________

4. Open the Throughput graph from the Web Resources category.

How much did the average throughput decline as more Vusers were added?

________________________________________________________________________

Overall, do you think that the difference between 25 and 20 Vusers was small enough that you would feel confident allowing the higher load on your system?

________________________________________________________________________

5. When you have finished analyzing the results, save the analysis session as Lab6_cross20+25.

6. Close the LoadRunner Analysis window and the scenario Lab6_manual.lrs.

Page 315: Lr7web Book 04a

Manual Scenarios 6-67

6

Review Questions

Test your understanding of this lesson by answering the following questions:

1. Why is it a good practice to run one Vuser the first time, and more than one Vuser the next time?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. Why do the transaction measurements not matter when testing multiple Vusers to make sure they can run concurrently without errors?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 316: Lr7web Book 04a

6-68 LoadRunner for the Web 7.0

6

Page 317: Lr7web Book 04a

Goal-Oriented Scenarios 7-1

Goal-Oriented Scenarios

Page 318: Lr7web Book 04a

7-2 LoadRunner for the Web 7.0

7

2

In this lesson, you will learn:

��!������

• How to choose a scenario goal based onplanning

• How to create and run a goal-oriented scenario• Learn to perform more in-depth analysis

Page 319: Lr7web Book 04a

Goal-Oriented Scenarios 7-3

7

3

����<��� �� .��������/��� ����

ELEMENTS• Goal• Vuser Scripts• Load Generators• Rendezvous (optional)• Monitor options• Monitors• Run-Time Settings

selectscript

editgoal

GOAL–AUTO

select load generators

select monitor options*

selectmonitors*

select run-time settings

set rendezvouspolicy*

*OPTIONAL

Page 320: Lr7web Book 04a

7-4 LoadRunner for the Web 7.0

7

4

CREATE GOAL-ORIENTED SCENARIO

� �-��������

• Select Goal-OrientedScenario

• Select oneor moreVuserscripts

Page 321: Lr7web Book 04a

Goal-Oriented Scenarios 7-5

7

5

CREATE GOAL-ORIENTED SCENARIO

�������� ��������

• Response time• Throughput

– hits/second– transactions/

second• Number of

concurrentlyrunning Vusers

Choose one ofthese goals whenyou start a newgoal-orientedscenario:

Page 322: Lr7web Book 04a

7-6 LoadRunner for the Web 7.0

7

6

SELECT SCENARIO GOAL

����B�,���� �������

• Response time tests how many Vusers can run withoutexceeding a specified response time

• Measures response time of LoadRunner transactions

• Set minimum and maximum number of Vusers to run

• LoadRunner runs scenario until

– max. defined # of Vusers have run

– response time goal was exceeded before max. # ofVusers were run

Page 323: Lr7web Book 04a

Goal-Oriented Scenarios 7-7

7

7

SELECT SCENARIO GOAL

�����B����������

• Choose one:1. Hits/second

– available to Web Vusers only– measures HTTP requests per second

2. Transactions/second– select min. and max. number of Vusers to run

• LoadRunner runs scenario until– goal is reached– max. defined # of Vusers have run & goal was not

reached– throughput did not increase when additional Vusers

were run

Page 324: Lr7web Book 04a

7-8 LoadRunner for the Web 7.0

7

8

SELECT SCENARIO GOAL

����B�,� � ��-����

• Running Vusers tests how many Vusers canrun concurrently

• LoadRunner runs scenario until– all Vusers run all iterations of their scripts– no more Vusers can run

Page 325: Lr7web Book 04a

Goal-Oriented Scenarios 7-9

7

9

FROM PLANNING: GET SYSTEM USAGE INFORMATION

���2�8��������� �8�����

ONLINE BOOKSTORE (typical work day)

View shopping cart

AdministrativeProcesses

*Invoiceprocessing

*System backup

BusinessProcesses

Search for title

Purchase book

Create new account

*Not a Web task

REVIEW

Day

1 1

50 50 50 50

700 1600 500 300 150

500 200 170 140

2000 5000 500

40 30 50 100

12 122 24 46 68 810 10 12am pm

1500 1000

50 50 25 NightNight

Hours to beemulated

Page 326: Lr7web Book 04a

7-10 LoadRunner for the Web 7.0

7

10

+�� � �<4��� �����;�� ����� �,���� �������

• Based on the task distribution diagram "Typical Work Day,"you could define the following goal:

– Select a transaction to measure an entire businessprocess (e.g., "Search for title")

– Set response time to 5 seconds (or whatever your systemexperts think is reasonable)

– Set min. and max. number of Vusers to run

• Run the scenario and keep adding Vusers until responsetime exceeds 5 seconds

• Then you know how many users your system can handlebefore performance becomes unacceptable

EXAMPLE

Page 327: Lr7web Book 04a

Goal-Oriented Scenarios 7-11

7

11

+�� � �<4��� �����;�� ����� ��+�����

• Based on the task distribution diagram "Typical WorkDay," you could define the following goal:

– Select a transaction to measure an importantbusiness process step (e.g., the "Save" step for"Purchase book")

– Set transactions per second to 5 (or whatever yourdatabase administrator thinks is reasonable)

– Set min. and max. number of Vusers to run

• Run scenario to see if goal is reasonable given theexpected number of users

EXAMPLE

Page 328: Lr7web Book 04a

7-12 LoadRunner for the Web 7.0

7

12

CREATE GOAL-ORIENTED SCENARIO

0 ����� ��������;�� ��������� ��

Check Receive notification ifyou want to see this message

Page 329: Lr7web Book 04a

Goal-Oriented Scenarios 7-13

7

13

The Step up period cannot be less than 1 min. 30 secs.

CREATE GOAL-ORIENTED SCENARIO

0 ����� ��������;#�� �4������

You must choose a Transaction Nameif Goal Type is "Transaction ResponseTime" or "Transactions per Second"

Page 330: Lr7web Book 04a

7-14 LoadRunner for the Web 7.0

7

14

CREATE GOAL-ORIENTED SCENARIO

�� "�����#�� ��� �����

1. Click a cell in the Load Generators column.

Assign a "percent of target" to each load generator

NOTE: Adding load generators was covered in the previous lesson

2. Select a load generator from the list.3. Click in % of Target cell to change default value.

Page 331: Lr7web Book 04a

Goal-Oriented Scenarios 7-15

7

15

RUN GOAL-ORIENTED SCENARIO

������� ��� "������� ����

Select monitors which support your testing goal

REVIEW

What is enabledon the MonitorMenu dependson whichmonitor isselected below

Page 332: Lr7web Book 04a

7-16 LoadRunner for the Web 7.0

7

NOTE: If you want to set the bandwidth to emulate modem speed (Browser Emulation tab), you should also select Run Vuser as a process in the General tab. Modem speed emulation does not work when Vusers are run as threads.

16

RUN GOAL-ORIENTED SCENARIO

������,� <���������� ��

Configurebrowser andbandwidthsettings to testdifferent typesof real users

NOTE: When IP Spoofing, always use maximum bandwidth

Page 333: Lr7web Book 04a

Goal-Oriented Scenarios 7-17

7

17

0 ���������+����4��2 ��

In Web Page Breakdown tab of Options dialog:

• Check Enable Web Page Breakdown

• Set percentage of Vusers to a small numberso as not to impact response times

Page 334: Lr7web Book 04a

7-18 LoadRunner for the Web 7.0

7

18

����+����4��2 ��

One page takes farlonger than the others

Page 335: Lr7web Book 04a

Goal-Oriented Scenarios 7-19

7

19

����*�����"������+���

1. Hold pointer over graph line to see component name2. Select page from list

Page 336: Lr7web Book 04a

7-20 LoadRunner for the Web 7.0

7

20

6����� �� ������+���

Download Time Breakdown

Page 337: Lr7web Book 04a

Goal-Oriented Scenarios 7-21

7

21

����� � ��4��2 �� ���������

Page 338: Lr7web Book 04a

7-22 LoadRunner for the Web 7.0

7

22

���������,������

This is the same datathat appeared on thelive Apache monitor

Page 339: Lr7web Book 04a

Goal-Oriented Scenarios 7-23

7

23

*����2�8����������

• See the delaybetween "hops"

Page 340: Lr7web Book 04a

7-24 LoadRunner for the Web 7.0

7

24

*����2�8����������

• See the delaybetween "hops"

• Zoom in on asegment

Page 341: Lr7web Book 04a

Goal-Oriented Scenarios 7-25

7

25

���������� ������

Responsetime

Number oftransactions

This graph is filteredto show only thetransaction namedin the goal definition

X-axis is the common axis for both graphs

Y-axis scales are different foreach of the 2 merged graphs

Page 342: Lr7web Book 04a

7-26 LoadRunner for the Web 7.0

7

26

���� �������

View > Merge Graphs

Page 343: Lr7web Book 04a

Goal-Oriented Scenarios 7-27

7

Be aware that merged graphs may not always use the same scale. The sec-ond column of the grid, Scale, shows you what scale is being used for each line in the current graph. If there are differences, they will show up there.

27

���� �����

TransactionResponse Time +Running Vusers

RunningVusers

Page 344: Lr7web Book 04a

7-28 LoadRunner for the Web 7.0

7

28

(�������� ������

Criteria can be:= (equal to)< > (not equal to)

Selection examples:• A few transactions• A range of

response times• Part of a scenario• Group by different

fields

Page 345: Lr7web Book 04a

Goal-Oriented Scenarios 7-29

7

29

�������(����

• More filter conditions than single graph filters• Criteria can be "=" or "< >"

Page 346: Lr7web Book 04a

7-30 LoadRunner for the Web 7.0

7

30

�� ����� ������

Transactionkey

TRANSACTION RESPONSE TIME - DISTRIBUTION

Page 347: Lr7web Book 04a

Goal-Oriented Scenarios 7-31

7

31

(����� ��� ����� ������

Same graph as on previous slide with all but3 transactions filtered out

Use a filter to removeclutter from a graph

Page 348: Lr7web Book 04a

7-32 LoadRunner for the Web 7.0

7

32

(� � ������ �����

Select a row tohighlight theassociated graph

Page 349: Lr7web Book 04a

Goal-Oriented Scenarios 7-33

7

34

8����8�� ������ �

• Right-click on a barin the graph

• Select "Drill Down"to open dialog box

• Select aTransaction

• Select a Group Byfield

• Repeat if desired

Page 350: Lr7web Book 04a

7-34 LoadRunner for the Web 7.0

7

35

�"���8���� ��8��

Page 351: Lr7web Book 04a

Goal-Oriented Scenarios 7-35

7

One reason you might want to compare load generators is if one is on the LAN inside the firewall and the other is remote. LoadRunner lets you test on both sides of the firewall.

36

�������#�� ��� �����

• Right-click graph line• Select "Drill Down" from pop-up• Select "Host Name" from Group By

Page 352: Lr7web Book 04a

7-36 LoadRunner for the Web 7.0

7

37

� ����� ��,�������'�� ����������#�� ��� �����

Collating results from multiple load generatorscan be slow and might take a long time

Page 353: Lr7web Book 04a

Goal-Oriented Scenarios 7-37

7

38

������

• The LoadRunner Controller helps you to:– create scenarios– run the Vusers– collect performance data

• Scenarios consist of generators, scripts, Vusers,monitors, run-time settings, and results folders

• Follow the LoadRunner Scenario execution process• Initialize Vusers before running them• Analyze a load test depending on the objective

Page 354: Lr7web Book 04a

7-38 LoadRunner for the Web 7.0

7

Page 355: Lr7web Book 04a

Goal-Oriented Scenarios 7-39

7

Exercises

Exercise A: Create and Run a Goal-Oriented Scenario

In this exercise you will create a goal-oriented scenario with the existing Vuser, \web_project\Vusers\Lab5vuser4.

The scenario goal is learn how the servers perform when there are more than 25 hits per second on the site.

Setup. 1. Create a new goal-oriented scenario with Lab5vuser4.

Create a new scenario in the LoadRunner Controller.Select Goal-Oriented Scenario for the Scenario type.Select the script “Lab5vuser4” and add it to the scenario.Click OK to close the New Scenario dialog and display the Design tab.

2. Name the Goal.Click the Edit Scenario Goal button. The Edit Scenario Goal dialog opens.Click the Rename button. The New Goal Profile dialog opens.Type Hits per Second 25 in the Name box and click OK.

On what factors will you base your decisions for hits per second, minimum and maximum Vusers?

________________________________________________________________________

3. Define the goal.Under Define Scenario Goal select “Hits per Second” from the Goal Type list.Type 25 in the Reach goal of edit box.Type 10 in the Using a minimum of box and 25 in the and a maximum of box.In the Run Time frame change Run for to 1 minute.Select the Stop scenario and save results radio button in the Scenario Settings tab.Click the Load Behavior tab and select the Automatic button.Click OK to save the changes and close the Edit Scenario Goal window.

Page 356: Lr7web Book 04a

7-40 LoadRunner for the Web 7.0

7

4. Rename the group Lab7-goal.Click in the first row of the Script Name column, overwrite "Lab5vuser4" with Lab7-goal and press Enter.

NOTE: The Details button opens the Script Information dialog for a goal scenario. This is unlike a manual scenario where it opens the Group Information dialog, allowing you to rename the group within.

5. Add the load generator to the scenario and connect to it.If you need help with this step, please refer to the Manual Scenarios lesson.

6. Assign the load generator to the Lab7 group.

7. Select the Run-time Settings.In the Design tab click the Run-Time Settings button. Verify that the Run-Time Set-tings agree with those in the following table. Change any setting that does not agree with its corresponding line in the table. If there is no line in the table for a particular setting, leave it as is.

8. Specify the result file: \web_project\Results\Lab7_25hits-sec

TAB SETTINGS

Pacing Enter 4 in Number of Iterations edit box.

Log Select Disable logging

Think Time Check Ignore think time.

Preferences Check Verification checks

General Uncheck Continue on error.Select Run Vuser as a thread. (Win 2000 or NT only)Check Define each action as a transaction.Check Define each step as a transaction.

Page 357: Lr7web Book 04a

Goal-Oriented Scenarios 7-41

7

Add and Configure MonitorsWhich monitor should you select to watch progress towards the scenario goal?

________________________________________________________________________

1. Add the Hits per Second monitor.(Skip this step if hits per second is already present in one of the graph panes.)

2. Add the Apache Web Server Resource monitor with all 5 measurements.If you need help with this step, please refer to Lesson 6.

3. Add the Windows Resources Monitor.(Skip this step if Windows Resources is already present.)If you need help with this step, please refer to Lesson 6.

4. Save the scenario as \web_project\Scenarios\Lab7_goal.lrs,

Run Scenario and Verify that Goal was Reached. 1. Run the Scenario.

Click the Start Scenario button or select Scenario > Start.

Did the scenario achieve your hits per second goal? How do you know?

________________________________________________________________________

2. Compare transaction response times with hits per second.Click the Transaction Response Time - Average tab to display the graph.Select View > Merge Graphs to open the Merge Graphs dialog box.In the Merge Graphs dialog select "Hits per Second" from the Select graph to merge with list.If Overlay is not selected for Select type of merge, select it.Click OK.

Page 358: Lr7web Book 04a

7-42 LoadRunner for the Web 7.0

7

3. Highlight hits per second in the graph.In the grid below the graph click the "Hits" row.Notice that the left y-axis shows average response time (for the transactions), and the right y-axis shows the number of hits per second.

Analyze the graph to see if you can determine how transaction response times were affected by the number of hits.

________________________________________________________________________

4. Close all open windows after you finish analyzing the run results.

5. Click yes if you see a message asking you to save the current Analysis session.Save it as: \web_project\results\Lab7_25hits-sec\res1

(Optional) Increase Goal and Run Again 1. If your Lab7 scenario reached its goal when running fewer than 25 Vusers,

increase the number of hits per second in the goal definition and run the sce-nario again.

Page 359: Lr7web Book 04a

Goal-Oriented Scenarios 7-43

7

Review Questions

Test your understanding of this lesson by answering the following questions:

1. What Run-Time Settings can you use to help emulate real users?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. Why run more Vusers than your anticipated peak load?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 360: Lr7web Book 04a

7-44 LoadRunner for the Web 7.0

7

Page 361: Lr7web Book 04a

Part 3: Data Correlation

Page 362: Lr7web Book 04a
Page 363: Lr7web Book 04a

Manual Correlation 8-1

Manual Correlation

Page 364: Lr7web Book 04a

8-2 LoadRunner for the Web 7.0

8

2

��!������

In this lesson, you will learn:

• Problems caused by recorded dynamic values

• How to parameterize and correlate dynamic,unpredictable values manually, using LoadRunnerscript functions

Page 365: Lr7web Book 04a

Manual Correlation 8-3

8

3

,�����������<����� C8� ����8���

• The system outputs data needed later for input, such as

– System generated session ids

– URLs that change each time you access the Web page

– Fields (sometimes hidden) recorded during a formsubmission

• The data is only good for the current session

Correlate the data

• Capture output value from one step

• Use captured value as input to another step

SOLUTION

PROBLEM

Page 366: Lr7web Book 04a

8-4 LoadRunner for the Web 7.0

8

4

&��������'�� �� �����������

������� �8���

DEFINITION

Correlated data is data which is sentto the client from the server, and latersent back to the server by the client.

Page 367: Lr7web Book 04a

Manual Correlation 8-5

8

5

,����������������� �8���;� ����������������

Welcome[Session ID =12345 (hidden)]

Login

EXAMPLE

Send me a list[Session ID =

12345 (hidden)]

Dynamic data is correlated automatically by the clientapplication (running in the browser) while recording ascript

Internet

Webserver

1

2

Page 368: Lr7web Book 04a

8-6 LoadRunner for the Web 7.0

8

The cause of this Vuser execution problem is that the dynamic value returned from the server was recorded and, therefore, was part of the Vuser script. When the script is played back, the Vuser attempts to reuse the recorded value, while the server is expecting another value, assigned for the current playback session.

6

Vuser

,����������������� �8���;� ���#����������

Webserver

Internet

Welcome[Session ID =23456 (hidden)]

Login

EXAMPLE

Send me a list[Session ID =

12345 (hidden)]

• Reusing recorded dynamic data will cause errorswhen you replay the script

• Recorded dynamic data must be recorrelated usingparameters

1

2

Page 369: Lr7web Book 04a

Manual Correlation 8-7

8

7

������� ��8���������-���

There are several ways to correlate data in VuGen:

• Manual correlation (covered in this lesson)

• Automatic correlation after recording (coveredlater)

• Automatic correlation during recording (coveredlater)

Page 370: Lr7web Book 04a

8-8 LoadRunner for the Web 7.0

8

8

��-�����������"��������

EXAMPLE

web_add_cookie Puts info on PC

Support Intro Clicks a link

Gets new page after selecting Product LoadRunnerkbBrowse.jsp

kbBrowse3.jsp Clicks Log Out button

kbBrowse2.jsp Clicks Retrieve after selecting Sort By Date

index.jsp Submits login form

URL=http://support.merc-int.com Invokes Mercury Interactive Support home page

Page 371: Lr7web Book 04a

Manual Correlation 8-9

8

9

�������(���� �8�� ��+�����2

Q: Why did the step creation fail? 1. Make a note of which step failed. 2. Look at the results of the previous step.

PROBLEM

Page 372: Lr7web Book 04a

8-10 LoadRunner for the Web 7.0

8

10

���2�����+�����������

A: Step creation failed because the session timed out.

Q: Why did the session time out? Let’s see if the Execution Log can tell us.

PROBLEM

Page 373: Lr7web Book 04a

Manual Correlation 8-11

8

11

01����� �#���,�������+�����

A: Immediately above the error, the Execution Log showsthat a session ID was redirected to a timeout page.

There must be a problem with the session ID in the script.

PROBLEM

Q: What do we know about session IDs?

A: Session IDs are dynamic. They work for only one session. Servers generate a new ID for every session.

Page 374: Lr7web Book 04a

8-12 LoadRunner for the Web 7.0

8

12

��8� ����-���������,�� � • Double-click the red "Error" line in the Execution Log.

VuGen puts the cursor on the script line that was executingwhen the error occurred.

CAUSE

Q: What is the solution?

• The session ID is hard-coded in the script. It worked for therecording session, but it won’t work for any playback session.

Page 375: Lr7web Book 04a

Manual Correlation 8-13

8

13

������������8� ����-����� �����-��������

1. Determine the value to capture

2. Find the right and left text boundaries of the value to capture

3. Find which occurrence of the text boundaries should be used

4. Add a web_reg_save_param function to the script, above thestep which requests the page with the value to capture

5. Add the parameter name, left boundary, right boundary, andoccurrence to the function

6. Parameterize the dynamic value in the script every time itoccurs

7. Verify correct execution

SOLUTION

Page 376: Lr7web Book 04a

8-14 LoadRunner for the Web 7.0

8

14

MANUAL CORRELATION

7)�8����� ������-��������������

1.1 Create 2 identical Vusers

1.2 Compare the 2 scripts

Page 377: Lr7web Book 04a

Manual Correlation 8-15

8

In order to determine which values are dynamic but get hard-coded into the script during recording, create two Vusers with the same action steps and input data. The idea is to compare the contents of two nearly identical scripts to see if any values changed.

15

DETERMINE THE VALUE TO CAPTURE

7)7������������ � �����-����

Q: Is the session ID in our example dependent on any user input data?

• Re-record the Vuser with exactly the same steps

• If the dynamic value you need to capture is– dependent on an input data value, then change only that

value

– independent of any input data, then re-record with exactlythe same data

A: No.

Page 378: Lr7web Book 04a

8-16 LoadRunner for the Web 7.0

8

Tools > Compare with Vuser runs a utility program called WDiff.exe. You can run this program even when VuGen is not running. It is found in the \bin folder of LoadRunner.

16

DETERMINE THE VALUE TO CAPTURE

7)9�����������������

• Select Tools > Compare with Vuser to open the OpenTest dialog

• Select thecurrentVuser’stwin fromthe dialog

• VuGencomparesthe Vusercurrentlyvisible withthe Vuseryou select

Page 379: Lr7web Book 04a

Manual Correlation 8-17

8

This is how WDiff compares the files. It goes through each line of the script and highlights the lines where differences occur. In this example, WDiff noted three lines in each script that have mismatches.

17

COMPARE THE SCRIPTS

�8�""����������������8�""�� ��

web_add_cookie("BV_IDS=ialllegddfhbemfcfkmcfeedhi.0: web_add_cookie("BV_IDS=eallldfiieebemfcfkmcfeedhi.0:@@@@1345195498.0999297950@@@@", @@@@1920023721.0999189073@@@@",

"Name=x", "Value=35", ENDITEM,"Name=y", "Value=8", ENDITEM,

"Name=x", "Value=29", ENDITEM,"Name=y", "Value=13", ENDITEM,

1

2

"URL= . . . ?BV_SessionID=@@@@2089996444.0999297996@@@@&", " URL= . . . ?BV_SessionID=@@@@0046855696.0999189747@@@@&",3

This is the step that failed

Page 380: Lr7web Book 04a

8-18 LoadRunner for the Web 7.0

8

18

1. DETERMINE THE VALUE TO CAPTURE

+����������-����.�/�,���� � ���������

• This value changes every session• It was not reused by the script

• This value changesevery session

• It was reused by thescript

• These values represent the screenlocations of mouse clicks

• They were not reused by the script

• Think times, if recorded, also arenot reused This is the step that failed

web_add_cookie("BV_IDS=….@@@@1345195498.0999297950@@@@",

"Name=x", "Value=35", ENDITEM,

"Name=y", "Value=8",ENDITEM,

URL=…?BV_SessionID=@@@@2089996444.0999297996@@@@&

1

2

3

Page 381: Lr7web Book 04a

Manual Correlation 8-19

8

19

9)�(� �������1��4�� ����

Copy the dynamic value (in this case,the "BV_SessionID") from the firstVuser in WDiff to Notepad usingCtrl+Ins (Ctrl+C won’t work)

Page 382: Lr7web Book 04a

8-20 LoadRunner for the Web 7.0

8

20

2. FIND THE TEXT BOUNDARIES

(� ��������#�+���

• In the Execution Log,double-click the linecausing the error

• The pointer jumps tocorresponding step inthe icon tree andopens that HTML page

Page 383: Lr7web Book 04a

Manual Correlation 8-21

8

■ The left boundary is the text immediately to the left of the dynamic value you want to capture.

■ The right boundary is the text immediately to the right of the dynamic value.

Note: In LoadRunner’s Script View, certain characters (such as the double quotation marks) have special functions. When you want to include such a character as part of boundary text, you must precede that character with a backslash. In script functions, the backslash is used as a control character to indicate that the character which follows is meant to be processed as text. For example:

■ abc\"" indicates the boundary abc".

■ abc\\ indicates the boundary abc\.

21

2. FIND THE TEXT BOUNDARIES

(� �4�� ������ ����#�-���

RIGHT BOUNDARY

3. Click Find.

LEFT BOUNDARY

In HTML View:1. Open the Find

dialog(Ctrl+F).

2. Paste valuecopied fromWDiff into FindWhat box.

Page 384: Lr7web Book 04a

8-22 LoadRunner for the Web 7.0

8

22

2. FIND THE TEXT BOUNDARIES

#�"��4�� �������� ����' �>��

RIGHT BOUNDARY

• LB should be asnearly unique aspossible

• In this example,"BV_SessionID="is a good choice

• RB should notappear in stringto be captured

• "&" is OK to usefor RB in thisexample

LEFT BOUNDARY

Page 385: Lr7web Book 04a

Manual Correlation 8-23

8

23

2. FIND THE TEXT BOUNDARIES

(� �4�� ������ �,�� � ��#��

• VuGen puts lines breaks in the Recording Logthat are not in the HTML

Page 386: Lr7web Book 04a

8-24 LoadRunner for the Web 7.0

8

24

2. FIND THE TEXT BOUNDARIES

(� �4�� ������ �,�� � ��#��

FOUND

NOTFOUND

• Find doesn’t work when text spans a line break

Page 387: Lr7web Book 04a

Manual Correlation 8-25

8

The boundaries of the dynamic value could occur more than once on the page. If they do, the value within those boundaries might not be the same in each instance. One of the difficulties about manual correlation is that you not only must find the left and right boundaries, but you must also make sure that you find the occurrence of those boundaries that contains the value you need to correlate.

25

3. FIND WHICH OCCURRENCE TO CAPTURE

(� ���� ��� �01����� �#��

This worksonly whenDatareturnedfrom serverwas checkedin Log Run-TimeSettingsbeforeplayback

Page 388: Lr7web Book 04a

8-26 LoadRunner for the Web 7.0

8

26

3. FIND WHICH OCCURRENCE TO CAPTURE

+����4�2�����������8�����

In Run-TimeSettings, Log tab:• Select

Extended log• Check Data

returned byserver

If these were notselected beforeyour last playback,select them andplay back theVuser again

Page 389: Lr7web Book 04a

Manual Correlation 8-27

8

27

4. ADD FUNCTION TO SCRIPT

���D��D����D����.�/E

web_reg_save_param ("param_name", "<List of Attributes>", LAST);

ATTRIBUTES• NOTFOUND* – ERROR (default) or EMPTY• LB – Left boundary: string enclosing left side of captured value• RB – Right boundary: string enclosing right side of captured value• RELFRAMEID* – Hierarchy level of the HTML page relative to

the requested URL• SEARCH* – Scope: Headers, Body, or ALL (default)• ORD* – Ordinal: occurrence number of the match (default=1)

*optional

Page 390: Lr7web Book 04a

8-28 LoadRunner for the Web 7.0

8

ORD, the occurrence attribute, is optional. If you omit it, the default value is 1.

NOTE: Executing web_reg_save_param always succeeds (return code = 0), with the parameter being assigned the value "" (NULL). (This can be veri-fied from the Execution Log.) If, and only if, the function is on the correct line, with the correct boundaries, will it capture the dynamic value.

28

4. ADD FUNCTION TO SCRIPT

���D��D����D����.�/E

web_reg_save_param ("param_name","LB=","RB=","ORD=",LAST);

User-definedparameter name

These strings can be found in VuGen’sRecording Log, in the source HTML of the pagewhere the dynamic value resides, and in theExecution Log when Extended Log was selectedand Data returned by Server was checked.

Create a parameter by adding thefollowing statement to the Vuser script:

Occurrence*

Indicates "nomore attributes"

*optional

Page 391: Lr7web Book 04a

Manual Correlation 8-29

8

Why should the web_reg_save_param statement be added before the step that sends for the page with the dynamic value?

During playback, when VuGen executes the web_reg_save_param state-ment, three things occur:

1. VuGen creates the parameter specified in the first argument.

2. When the next step is executed, VuGen searches the HTML source of that page for the text specified by the left and right boundary arguments in the statement.

3. When the value is found, VuGen places it into the defined parameter.

Thereafter, whenever VuGen encounters a reference to the parameter name later in the script, it will plug in the value stored there.

29

� �(� ��� ��������4�"���-��������,�>�����

4.1 Add web_reg_save_param () before the step that getsthe page with a dynamic value.

Support Intro Clicks a link

Gets new page after selecting Product LoadRunnerkbBrowse.jsp

kbBrowse3.jsp Clicks Log Out button

kbBrowse2.jsp Clicks Retrieve after selecting Sort By Date

index.jsp Submits login form

web_add_cookie Puts info on PC

URL=http://support.merc-int.com Invokes Mercury Interactive Support home page

Q: What if you don’t know which step requests the page whichcontains the dynamic value?

This is the step that getsthe dynamic value

This is the step that usesthe dynamic value

Page 392: Lr7web Book 04a

8-30 LoadRunner for the Web 7.0

8

30

�������+�������������(� ���

A: If you’re not sure which step gets the value, use thefollowing procedure to place the function correctly.

1. In the Execution Log, find the correct occurrence of the leftboundary.

2. Double-click that line in the Execution Log to jump to thecorresponding line in either the Script View or the Tree View.

3. Insert a new step: web_reg_save_param()

4. Enter the parameter name and attributes you want, click OK.

5. VuGen inserts the function into the correct spot.

Page 393: Lr7web Book 04a

Manual Correlation 8-31

8

31

=)�� �(� ��� ������ ��

web_reg_save_param ("param_name","LB=","RB=","ORD=",LAST);

• Add the instance ("ORD") from the Execution Log

• Name the parameter• Copy the boundary text from the HTML

Page 394: Lr7web Book 04a

8-32 LoadRunner for the Web 7.0

8

1. Select Edit > Replace from the menu. The Search and Replace dialog opens.

2. Paste or type the original recorded value in the Find What box.

3. Type the parameter name in the Replace With box. The parameter name:

■ must be the same as the name defined in the web_reg_save_param statement

■ must be enclosed within braces { }*

4. Press the Find Next button.

5. When LoadRunner finds the value, press the Replace All button.

* Braces are VuGen’s default parameter enclosure characters. The user may change this character from the Parameterization tab of the General Options dialog box. (Select Tools > General Options.)

32

F)�+��������������-����.�/� ���������

• Addbracesto theparametername

• ClickReplaceAll

Page 395: Lr7web Book 04a

Manual Correlation 8-33

8

33

F)�+��������������-����� ���������

Page 396: Lr7web Book 04a

8-34 LoadRunner for the Web 7.0

8

34

���������2�

web_reg_save_param

specifies "sessID" tostore the dynamic value

Page 397: Lr7web Book 04a

Manual Correlation 8-35

8

A parameter acts like a placeholder or a variable.

■ A parameter replaces a literal value in the script.

■ VuGen substitutes a captured, dynamic value for the parameter at run time.

35

���������2�

• This step used to havethe recorded, hard-coded value

• When script is playedback, VuGen substitutesthe captured value for"sessID"

Page 398: Lr7web Book 04a

8-36 LoadRunner for the Web 7.0

8

If you don’t check these settings, you won’t be able to tell for certain whether the process worked.

36

7. VERIFY CORRECT EXECUTION

,� <���������� ���#��

Select Extended log, and check Parametersubstitution

Page 399: Lr7web Book 04a

Manual Correlation 8-37

8

37

7. VERIFY CORRECT EXECUTION

���2������,������

In thisexample,it wasnecessaryto save 2dynamicvalues

Repeat theprocedure ifnecessary

Page 400: Lr7web Book 04a

8-38 LoadRunner for the Web 7.0

8

38

7. VERIFY CORRECT EXECUTION

���2�01����� �#��

These arethe captured

dynamic valuesLine # in script

Page 401: Lr7web Book 04a

Manual Correlation 8-39

8

39

7. VERIFY CORRECT EXECUTION

���2�01����� �#��

These show thereplacement of

parameters withcaptured data

later in the script

Page 402: Lr7web Book 04a

8-40 LoadRunner for the Web 7.0

8

40

&��������'�� �� �����������

8����8��� � �

DEFINITION

Data which is valid only when used with certainother data.In the login process, for example, the password isdependent on the username. When the username changes,the password must also change or the login won’t work.

Page 403: Lr7web Book 04a

Manual Correlation 8-41

8

41

8����8��� � ��(��� �

• You want to test your shopping application withseveral different merchandise items

• After parameterizing the item name, the applicationworks for the recorded item and fails for all others

• Find and parameterize the dependent dataas well as the name of the merchandise item

SOLUTION

PROBLEM

Page 404: Lr7web Book 04a

8-42 LoadRunner for the Web 7.0

8

42

-����,������(����

If all iterations fail exceptthe one which used therecorded value, thatusually indicates a datadependent value hard-coded in your script

Page 405: Lr7web Book 04a

Manual Correlation 8-43

8

43

VUSER REPLAY FAILS

� � ��"�� ������+�����

SkiPants

Goggles

Gloves

SkiJacket

ITEMDESCRIPTION

Original Recorded Value

Additional values from a data file after parameterizing the item description

TESTSTATUS

Page 406: Lr7web Book 04a

8-44 LoadRunner for the Web 7.0

8

44

VUSER REPLAY FAILS

� � ��"�� ������+�����

Using procedures taught in this lesson, you wouldfind that the Item Number changed whenever adifferent Item Description was selected (i.e., theItem Number is dependent on the Item Description)

1000124SkiPants

1000125Goggles

1000126Gloves

1000123SkiJacket

ITEMNUMBER

TESTSTATUS

ITEMDESCRIPTION

Page 407: Lr7web Book 04a

Manual Correlation 8-45

8

45

DETERMINE THE VALUE TO CAPTURE

7)7������������ � �����-����

• Re-record the Vuser with exactly the same steps

• If the dynamic value you need to capture is– dependent on an input data value, then change only that

value

– independent of any input data, then re-record with exactlythe same data

REVIEW

Q: Is the Item Number in our example dependent onany user input data?

A: Yes. It is dependent on the Item Description.

Page 408: Lr7web Book 04a

8-46 LoadRunner for the Web 7.0

8

46

��������8��� � ��-����.�/

The solution is the same as that shown previouslyfor the SessionID, except that, when recording the2nd Vuser you would change the Item Description

SOLUTION

SkiPants

Goggles

Gloves

SkiJacket

TESTSTATUS

ITEMDESCRIPTION

Recordusingone ofthesevalues

Page 409: Lr7web Book 04a

Manual Correlation 8-47

8

47

������

To find and correlate a dynamic value manually:

• Determine the value to capture

• Find the left and right boundaries of the value

• Find the occurrence you need to capture

• Add a web_reg_save_param statement before thestep that requests a page with a dynamic value

• Parameterize the all occurrences of the dynamicvalue in the script

• Verify correct execution

• Repeat the procedure if necessary

Page 410: Lr7web Book 04a

8-48 LoadRunner for the Web 7.0

8

Page 411: Lr7web Book 04a

Manual Correlation 8-49

8

Exercises

Exercise A: Create Vuser to Book a New Flight

Setup and Sign-in 1. Create a new Web Vuser in VuGen.

2. Make sure that the following Recording Options are set. Don’t change any other options if they are not in the table.

3. Make sure that the following General Options are set in the Correlation tab. Don’t change any other options if they are not in the tableSelect Tools > General Options.

4. Start recording with Mercury Tours into Action1.Leave Record the application startup checked.

TAB RECORDING OPTION VALUE

Recording HTML-based script selected

Correlation Enable correlation system-wide unchecked

Advanced all unchecked

GENERAL OPTION, CORRELATION TAB VALUE

Save correlation information during replay checked

Show Scan for correlations pop-up after replay of Vuser unchecked

Show only differences that appear in script checked

Enable Scripting and Java applets on Snapshots viewer unchecked

Download images on Snapshots viewer checked

Scan for differences . . . snapshots using: HTML comparison selected

Page 412: Lr7web Book 04a

8-50 LoadRunner for the Web 7.0

8

5. Sign in to the Mercury Tours Web site as jojo with the password bean.

Record a Flight Reservation 1. Enter the flight information to the FLIGHT FINDER page.

Accept the defaults for all input fields except as noted in the table below.

2. Click the CONTINUE button.

3. Accept the first departing flight in the list.By default, the first available flight is selected for each direction when the SELECT FLIGHT page appears.

4. Select the last (4th) return flight in the list.

5. Click the CONTINUE button on the SELECT FLIGHT page.

6. Purchase the selected flight.Enter the passenger and credit card information in the BOOK A FLIGHT page. Use data from the following table.

7. Click the SECURE PURCHASE button on the BOOK A FLIGHT page.

8. Insert a checkpoint to verify that the Flight Confirmation page appeared.

FIELD VALUE

Departing From San Francisco

Arriving In New York

FIELD VALUE

First Name Joseph

Last Name Frisbee

Number 987654321

Page 413: Lr7web Book 04a

Manual Correlation 8-51

8

Sign-off and Parameterize the Cities 1. In the browser, click SIGN-OFF and wait for the SIGN-ON page to appear.

2. In VuGen, stop recording.

3. Save the Vuser as: \web_project\Vusers\Lab8original

4. Save the Vuser again as: \web_project\Vusers\Lab8vuser1

When editing Vusers, it is recommended to keep an original copy of the script. Save your script with a different name before making changes to it.

Which step includes the input steps for the fly from and fly to cities?

________________________________________________________________________

5. Parameterize the fromPort and toPort fields as type file, sequential.Select the ReservationServlet step.Use Depart as the Parameter Name for fromPort field.Use Return as the Parameter Name for toPort field.Put the values from the table below into one data file.If you need help completing this step, please refer to lesson 5.

DEPART RETURN

San Francisco New York

Seattle Frankfurt

Sydney London

Zurich Acapulco

TIP

Page 414: Lr7web Book 04a

8-52 LoadRunner for the Web 7.0

8

Verify Correct Execution 1. Set the Vuser to iterate 4 times and to show parameter values and server data in

the Execution Log.Verify that the settings agree with those in the following table. Change any setting that does not agree with the table, then click OK. Don’t change any settings that are not in the table.

2. Save, then run Lab8vuser1.Accept the default results directory result1. Click OK.

Click the Recording Log tab to speed up playback.

3. Review the execution results.

Did the Vuser iterate 4 times?

________________________________________________________________________

In the Test Results, did any iteration fail? If yes, which iterations failed?

________________________________________________________________________

What was the name of the first step where an iteration failed?

________________________________________________________________________

TAB SETTINGS

Pacing Set Number of Iterations to 4

Log Select Extended logCheck Parameter substitutionCheck Data returned by server

Preferences Check Verification checks

TIP

Page 415: Lr7web Book 04a

Manual Correlation 8-53

8

Based on the lesson presented, why do you think iterations 2, 3, and 4 failed while iteration 1 passed?

________________________________________________________________________

________________________________________________________________________

Exercise B: Recreate Vuser and Compare with Original

Exercise objective: Find the dynamic data to capture.

Setup and Login 1. Create a new Web Vuser in VuGen.

2. Start recording with Mercury Tours into Action1.Leave Record the application startup checked.

3. Sign in to the Mercury Tours Web site as jojo with the password bean.

Record Flight ReservationUse the same steps as in Exercise A to record another Vuser, changing only one data element in the process.

1. Enter the flight information from the FLIGHT FINDER page.Accept the defaults for all input fields except as noted in the table below. Note that only the Departing From value is different from that used to record Lab8vuser1.

FIELD VALUE

Departing From Seattle

Arriving In New York

Page 416: Lr7web Book 04a

8-54 LoadRunner for the Web 7.0

8

Why do you think that only one data value should be changed for the 2nd record-ing?

________________________________________________________________________

________________________________________________________________________

2. Click the CONTINUE button.

3. Select the first departing flight in the list and the last (4th) return flight.

4. Click the CONTINUE button on the SELECT FLIGHT page.

5. Purchase the selected flight.Enter the passenger and credit card information in The BOOK A FLIGHT page. Use data from the following table.

6. Click the SECURE PURCHASE button on the BOOK A FLIGHT page.The FLIGHT CONFIRMATION page appears.

7. Insert a checkpoint to verify that the Flight Confirmation page appeared.

8. Click SIGN-OFF and wait for the SIGN-ON page to appear.

9. In VuGen, stop recording.

10. Save the Vuser script as: \web_project\Vusers\Lab8vuser2

FIELD VALUE

First Name Joseph

Last Name Frisbee

Number 987654321

Page 417: Lr7web Book 04a

Manual Correlation 8-55

8

Compare the Two Vusers 1. Invoke the WDiff utility.

Make sure that Action1.c is highlighted in the Action list (not vuser_init or vuser_end).Select Tools > Compare with Vuser. The Open Test dialog box appears.Select “Lab8vuser1” and click Open.WDiff opens with Lab8vuser2\Action1.c and Lab8vuser1\Action1.c dis-played side-by-side. Lines which are different in the two files are highlighted.

What differences did you find between the two files at the step that failed?

________________________________________________________________________

________________________________________________________________________

Which difference(s) should be captured for playback? Give a reason for your answer.

________________________________________________________________________

________________________________________________________________________

Why should you copy the outFlight AND inFlight values when only the outFlight input value changed from Lab8vuser1 to Lab8vuser2?

________________________________________________________________________

________________________________________________________________________

2. Copy the difference(s) to be captured in the Web Submit Form . . . PurchaseServ-let step from Lab8vuser1 in WDiff to Notepad.Open Notepad.Use Ctrl+Insert to copy from WDiff. NOTE: Ctrl+C doesn’t work here.Then use Ctrl+V to paste into Notepad.

Page 418: Lr7web Book 04a

8-56 LoadRunner for the Web 7.0

8

Exercise C: Fix the Vuser Script

Exercise objective: Capture and use the dynamic data in a Vuser script.

Find Boundaries and Occurrence of Dynamic DataThe example in the graphic shows how data in the script corresponds to objects on the Web page. In this application, flight numbers are unique and change when the airline or depart time changes. Also, prices vary with the flight. Therefore, capturing only the airline name or the time is not enough.

In the example shown in the graphic, what part of the string is dynamic and should be captured?

________________________________________________________________________

1. In VuGen, display Lab8vuser1, and open the Script View.

Which step submits the flight details? Which step causes the server to send the page with the flight details form?

________________________________________________________________________

________________________________________________________________________

"Value=Blue Skies Airlines$200$244$5:03 pm$" 1) 2) 3) 4)

partial lineof script

1) Airline2) Flight #3) Cost4) Time

"$" is a data delimiter

Page 419: Lr7web Book 04a

Manual Correlation 8-57

8

2. Find the first line in the Execution Log which shows an error.Put the cursor anywhere in the Execution Log.Press Ctrl+Home to go to the top of the log.Press Ctrl+F to open the Find dialog.Type Error in the Find What box.Check Match Case.Click the Find button.

What is the error message in the Execution Log?

________________________________________________________________________

________________________________________________________________________

What is the message on the previous line of the log?

________________________________________________________________________

________________________________________________________________________

The error message indicates that the web_submit_form . . . PurchaseServlet step tried to send the flight data to the server and was unsuccessful. The BOOK A FLIGHT page was received from the server in response to the previous (successful) step. That form contains the flight details for all available choices at that point in the process. What is the name of the step immediately preceding the PurchaseServlet step?

________________________________________________________________________

3. Find the dynamic value in the HTML.Switch to Tree View and click the HTML View tab.Highlight the ReservationServlet step in the Tree View.Put the cursor at the top of the HTML page in the Snapshot of Recording pane.Press Ctrl+F. The Find dialog opens.Copy the first dynamic value to be replaced from Notepad.Paste the value to be captured to the Find What box using Ctrl+V.Click the Find button.

Page 420: Lr7web Book 04a

8-58 LoadRunner for the Web 7.0

8

Would “value=” be a good left boundary? Give a reason for your answer.

________________________________________________________________________

________________________________________________________________________

What is the left boundary?

________________________________________________________________________

What is the right boundary?

________________________________________________________________________

4. Copy the left boundary of the dynamic value from the HTML.Select the boundary text you want to copy. The left boundary should be as nearly unique as possible.Right-click the selection and pick “Copy Selection” from the pop-up menu.NOTE: Ctrl+C doesn’t work here.

5. Paste the left boundary text into Notepad.

How will you determine the correct occurrence of the left boundary?

________________________________________________________________________

________________________________________________________________________

6. Find the correct occurrence of the left boundary in the Execution Log.Use Ctrl+Home to put the cursor at the top of the Execution Log.Press Ctrl+F to open the Find dialog.Type or paste the left boundary text into the Find What box.Move the Notepad window so that you can read the dynamic value from it while looking at the Execution log.Click Find.Compare the value following the left boundary with the value in Notepad.If they are the same, you have found the correct occurrence.If not, press Find again and compare.Continue this process until you find the correct occurrence.

Page 421: Lr7web Book 04a

Manual Correlation 8-59

8

Insert the Function in the Vuser 1. In the Execution Log, double-click the line containing the correct occurrence of

the left boundary.The pointer jumps to the corresponding line in the Script View.

Which line did the cursor jump to?

________________________________________________________________________

2. Open the Add Step dialog box.Right-click the current step in the icon tree and select "Insert Before" from the pop-up menu.The Add Step dialog opens.

3. Open the Save Data to a Parameter dialog box.Expand the “Services” category in the Add Step dialog box and select “web_reg_save_param.” The Save Data to a Parameter dialog opens.

4. Enter the Parameter Name, the LB, the RB, and the Instance, then click OK.Choose a descriptive name for the parameter, for example, outFlight_data.VuGen inserts the function at the correct spot in the script, immediately above the . . .ReservationServlet step.

Replace Recorded Values with Parameter 1. Switch to Script View.

2. Put the cursor at the top of the script, then select Edit > Replace.The Search and Replace dialog opens.

3. Enter the dynamic value in the Find What box.

4. Enter the parameter name (enclosed in braces) in the Replace With box.

5. Click Replace All, then close Search and Replace.

6. Save the modified Lab8vuser1 as Lab8vuser3.

Page 422: Lr7web Book 04a

8-60 LoadRunner for the Web 7.0

8

7. Repeat the entire procedure for the inFlight data.1. If you have not already done so, find the boundaries and the correct occurrence

for the inFlight data.2. Add another web_reg_save_param function to capture the inFlight data.3. In Script View, replace the occurrence(s) of that data with the parameter.

(The procedure for doing all this began at Step 3 in the section "Find Boundaries and occurrence of Dynamic Data" and ended at Step 5 of this section, "Replace Recorded Values with Parameter." )

Verify Correct Execution 1. Close the Run-Time Viewer and the Test Results window if they are still open.

2. Save, then run Lab8vuser3.

How can you verify that Lab8vuser3 captured the values correctly?

________________________________________________________________________

What flight numbers and ticket prices did Lab8vuser3 insert?

3. Close WDiff, Notepad, the Test Results window, the Run-Time Viewer, and all Vusers.

ITERA-TION outFlight_data inFlight_data

1

2

3

4

Page 423: Lr7web Book 04a

Manual Correlation 8-61

8

Review: Manual Correlation

Test your understanding of this lesson by answering the following questions:

1. How can parameterizing a recorded Vuser script expose data dependencies?

________________________________________________________________________

________________________________________________________________________

2. What usually indicates that your Vuser script has dynamic data which is depen-dent on your parameterized fields?

________________________________________________________________________

________________________________________________________________________

3. What technique should you use to find dynamic dependent data caused by parameterization?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 424: Lr7web Book 04a

8-62 LoadRunner for the Web 7.0

8

Page 425: Lr7web Book 04a

Automatic Correlation After Recording 9-1

Automatic Correlation After Recording

Page 426: Lr7web Book 04a

9-2 LoadRunner for the Web 7.0

9

2

��!�����

In this lesson, you will learn how tocorrelate data automatically after recording

Page 427: Lr7web Book 04a

Automatic Correlation After Recording 9-3

9

3

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 428: Lr7web Book 04a

9-4 LoadRunner for the Web 7.0

9

4

����������������������� �"���,�� � �

• To work correctly, automatic correlation requiresat least one playback

• Web pages captured during playback are neededto compare to Web pages captured duringrecording

• After playback, use the Scan for Correlations tool

Page 429: Lr7web Book 04a

Automatic Correlation After Recording 9-5

9

5

����������������������������"���,�� � �

1. Enable saving of replay correlation information

2. Play back the script in VuGen

3. Select the most recent replay results

4. Perform the scan

5. Correlate

6. Verify correct execution

PROCESS

Page 430: Lr7web Book 04a

9-6 LoadRunner for the Web 7.0

9

Open the General Options dialog box by selecting Tools > General Options.

Save correlation information during replay means to capture the Web pages returned by the server when you play back the recorded script. That must be done so that VuGen has something to compare to the Web pages cap-tured during recording.

If you don’t check this option, LoadRunner will have nothing to compare with the Web pages captured during recording, and therefore will be unable to correlate data.

Checking Show scan for correlations popup is optional because there are other ways to start a scan after playback:

■ click the Scan toolbar button

■ select Vuser > Scan

■ press Ctrl + F8

6

7)�0 �������������

2. Check Show Scan for correlations popup afterreplay of Vuser

In the Correlation tab of General Options:

1. Check Save correlation information during replay

Page 431: Lr7web Book 04a

Automatic Correlation After Recording 9-7

9

7

9)�+����4�2������� �-���

• Enable Generate report… and Display report…

• If Test Results show failure, correlation may beneeded at the failing step

Page 432: Lr7web Book 04a

9-8 LoadRunner for the Web 7.0

9

If the Vuser has been run more than once, and changes were made to the Vuser, scanning previous result files might yield incorrect results.

NOTE: Ignore the Iteration 0 folder.

8

:)������������,�� ��,������

If Vuser ran only once, skip this step3.1 Click Select Test Results button3.2 Select most recent result file

Page 433: Lr7web Book 04a

Automatic Correlation After Recording 9-9

9

9

?)�+�"��������������

Click Yes in "Scan for correlation" popup

Or, if the popup was not enabled:• click the Scan toolbar button• select Vuser > Scan• press Ctrl+F8

Page 434: Lr7web Book 04a

9-10 LoadRunner for the Web 7.0

9

10

=)��������

• Click CorrelateAll to see ifVuGen canaccomplish thecorrelation

• VuGen lists thescan results inthe CorrelationResults tab

The rightmost column, Count, indicates the number ofoccurrences of that difference between the recorded snapshots.

Page 435: Lr7web Book 04a

Automatic Correlation After Recording 9-11

9

11

�"�����������

Correlationsucceeded

Correlation Results tab

LR web functionsadded to script

Page 436: Lr7web Book 04a

9-12 LoadRunner for the Web 7.0

9

12

�"����������� ;�����-���

2 values captured with web_reg_save_param

2 parameters substituted for recorded values

Page 437: Lr7web Book 04a

Automatic Correlation After Recording 9-13

9

13

TuneSystem Based

on Analysis

#�� ,� ��01������2"���36���� ��� 5

AnalyzeSystem

Under Load

Phase 5

RunScenarios

Phase 4

CreateScenarios

Phase 3

Create WebVirtual Users

Phase 2Phase 1

Plan LoadTest

2.1 Record User Actions

2.2 Add LoadRunner transactions

2.3 Add verification checks

2.4 Parameterize Input Data

2.5 Correlate reused data

2.6 Verify correct execution

Page 438: Lr7web Book 04a

9-14 LoadRunner for the Web 7.0

9

14

F)�-��"�������01�����

Checkthe TestResultswindow

Page 439: Lr7web Book 04a

Automatic Correlation After Recording 9-15

9

15

������

Automatic correlation after recording:

• requires that Save correlation information duringreplay be enabled in the Correlation tab of theGeneral Options dialog

• requires at least one playback of the script

• is accomplished using the Scan for Correlations tooland the buttons in the Correlation tab

• adds the same web_reg_save_param function usedfor manual correlation

Page 440: Lr7web Book 04a

9-16 LoadRunner for the Web 7.0

9

Page 441: Lr7web Book 04a

Automatic Correlation After Recording 9-17

Planning Specification (continued):

Book a Flight

USER ACTIONS EXPECTED RESULTS

1 Invoke the Web browser, typehttp://localhost/MercuryWebTours/ for the URL address and press Enter.

The Mercury Tours home page appears.

2 Type the name in the User Name box. The member’s login name appears in the Member name box.

3 Type the password in the Password box. The member’s password appears as a string of asterisks in the Password box.

4 Click the Sign-In button. The Mercury Tours FLIGHT FINDER page appears.

5 Type the following data in the indicated fields on the FLIGHT FINDER page.

The Find Flight page appears with the following flight information fields:- Type- Passengers- Departing From- On- Arriving In- Returning- Service Class- Airline

6 Click the CONTINUE button. The SELECT FLIGHT page appears and returns all values of available flights.

7 Select the first available flight and click the CONTINUE button.

The BOOK A FLIGHT page appears.

8 Type the following data in the indicated fields on the BOOK A FLIGHT page.

- First Name- Last Name- Number

Page 442: Lr7web Book 04a

9-18 LoadRunner for the Web 7.0

9 Click the SECURE PURCHASE button. The FLIGHT CONFIRMATION page appears. It contains confir-mation of the reserved flight, and the flight and customer details.

10 Verify that the FLIGHT CONFIRMATION page appears, and that the page contains the text “Your itinerary has been booked!”.

11 Verify the flight number. Flight details appear in the FLIGHT CONFIRMATION page.

USER ACTIONS EXPECTED RESULTS

Page 443: Lr7web Book 04a

Automatic Correlation After Recording 9-19

9

Exercises

Run Vuser 1. Open Lab8vuser1 and save it as Lab9vuser1.

NOTE: If you did not complete Lab8vuser1 successfully, you can use \web_project\solutions\_Lab8vuser1.

2. Make sure that the following General Options are set in the Correlation tab. Don’t change any other options if they are not in the tableSelect Tools > General Options.

3. Make sure that the Run-Time Settings conform to those in the following table:

4. Run the Vuser script, then examine the Test Results.

GENERAL OPTION, CORRELATION TAB VALUE

Save correlation information during replay checked

Show Scan for correlations pop-up after replay of Vuser unchecked

Show only differences that appear in script checked

Enable Scripting and Java applets on Snapshots viewer unchecked

Download images on Snapshots viewer checked

Scan for differences . . . snapshots using: HTML comparison selected

TAB SETTING

Pacing set Iteration count to 4

Log select Extended logcheck Parameter substitutionuncheck Data returned by server

Preferences check Verification checks

Page 444: Lr7web Book 04a

9-20 LoadRunner for the Web 7.0

9

Did the Vuser script play back successfully?

________________________________________________________________________

Did the first iteration use the same fromPort and toPort as when you first recorded? Did the first iteration succeed?

________________________________________________________________________

Which iterations failed? What does this usually indicate?

________________________________________________________________________

Which step failed in the iterations that failed?

________________________________________________________________________

What was the error message displayed on the page for that step in Test Results?

________________________________________________________________________

5. Close the Test Results window and the Run-Time Viewer.

Fix Vuser with Automatic CorrelationWhich iteration will you choose for comparison with the recorded Reservation-Servlet step?

________________________________________________________________________

1. Open the results for the last iteration.Click the Select Test Result button in the Page View, Snapshot of Recording pane. The Select Test Result dialog opens.Select the last iteration of the last result in the list and click OK.The recorded results for that iteration are displayed in the Snapshot of Result pane.

NOTE: If you don’t see the Select Test Result button, select View > Snapshot from VuGen’s main menu. (Do not select View > Test Results.)

Page 445: Lr7web Book 04a

Automatic Correlation After Recording 9-21

9

2. Compare the recorded and replay text.Click the Scan for Correlations button in the VuGen toolbar.

What differences between the recorded and replayed text did the Correlation Results tab display?

________________________________________________________________________

3. Correlate the differences.Click the Correlate All button in the Correlation Results tab.Click Yes to the confirmation message.

Was the correlation successful? How could you tell?

________________________________________________________________________

What changes did automatic correlation make to the script?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

4. Save the script as Lab9vuser2.

5. Run Lab9vuser2.Accept the default results directory and click OK.

Did all 4 iterations pass this time?

________________________________________________________________________

6. Close the Test Results window and Lab9vuser2.

Page 446: Lr7web Book 04a

9-22 LoadRunner for the Web 7.0

9

Review Questions

Validate your understanding of this lesson by answering the following questions:

1. Why do you need at least one playback for automatic correlation after recording to work properly?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. Under what conditions will you choose to use automatic correlation during recording?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 447: Lr7web Book 04a

Automatic Correlation During Recording 10-1

Automatic Correlation During Recording

Page 448: Lr7web Book 04a

10-2 LoadRunner for the Web 7.0

10

2

��!������

In this lesson, you will learn how to:• correlate data automatically during recording• define your own rules for automatic correlation

Page 449: Lr7web Book 04a

Automatic Correlation During Recording 10-3

10

“Known context” refers to the behavior of the Web application server. It means that the rules for correlating dynamic data are known for a specific server. For example, LoadRunner knows that for a BroadVision server, a session ID follows the string “BV_SessionID=@@@@” and precedes “@@@@”.

If you are familiar with a Web application server that is not one for which LoadRunner has built-in rules, LoadRunner provides a means for you to create the rules to automate the data correlation process for that server. Those means are discussed later in this lesson.

3

��� ������������8�� �,�� � �

Correlate during recording when:

• The Web application server is on theRecording Options list of known server types

• The session has a known context

• You can determine rules for correlation

Page 450: Lr7web Book 04a

10-4 LoadRunner for the Web 7.0

10

4

����������������������� 8�� ��,�� � �

LoadRunner can correlate dynamic data withinknown application environments

• Correlation during recording is accomplishedusing the Correlation Recording Options

• Set correlation options before you record a script

• If VuGen finds server-generated data that is usedagain in the recorded action, VuGen automaticallycorrelates it (or prompts the user)

Page 451: Lr7web Book 04a

Automatic Correlation During Recording 10-5

10

5

+�� ���������������������� �8�� ��,�� � �

1. Set correlation recording options

2. Record

3. Verify correct execution

Page 452: Lr7web Book 04a

10-6 LoadRunner for the Web 7.0

10

Currently, the Auto Detect option works for the following application server types:

■ AribaBuyer

■ BlueMartini

■ BroadVision

■ InterStage

■ MySap

■ NetDynamics

■ SilverJRunner

6

1. SET CORRELATION RECORDING OPTIONS

0 �������������

1.2 Check Enablecorrelation system-wideto enable all otheroptions

1.1 Open the RecordingOptions dialog,Correlation tab

1.3 Check Auto-detectspecific web serversto enable theRequired servertypes list and theWhen detected, dothis options

Page 453: Lr7web Book 04a

Automatic Correlation During Recording 10-7

10

■ If you want correlation to happen automatically and behind the scenes, check Correlate in script. No user intervention during recording is required with this option.

■ If you want to decide whether to correlate on a case-by-case basis, check Issue online message.

■ Create rule(s) only is used for known contexts.

7

• Checking Issueonline messageallows user todecide whether tocorrelate case-by-case and disablesthe other options

1.4 Check a When detected, do this option

• Selecting Performoffline actions andchecking Correlatein script automatescompletely withoutuser intervention

1. SET CORRELATION RECORDING OPTIONS

'�� ������<8����

Page 454: Lr7web Book 04a

10-8 LoadRunner for the Web 7.0

10

You can also create rules and change the level of automation from the Cor-relation Warning dialog box during recording.

8

AUTOMATIC CORRELATION DURING RECORDING

9)�,��

2.2 Check a What to do nowoption:– Create rule(s)– Correlate in script

2.1 Start recording

– If Issue online messagewas checked, theCorrelation Warningdialog may appearduring recording

Page 455: Lr7web Book 04a

Automatic Correlation During Recording 10-9

10

Do this step every time you change a script before using it to test your application.

9

3. VERIFY CORRECT EXECUTION

������ ��������� �

Before replaying the script, open the General Optionsdialog and make sure that:

• Correlation tab–Save correlationinformation duringreplay is checked

• Display tab–Generate report...and Display report...are checked

Page 456: Lr7web Book 04a

10-10 LoadRunner for the Web 7.0

10

10

3. VERIFY CORRECT EXECUTION

����-���

Nocorrelation

Correlated

VuGen adds web_reg_save_param() to therecording where appropriate

NOTE: This is the same script used in Lesson 8

Page 457: Lr7web Book 04a

Automatic Correlation During Recording 10-11

10

11

3. VERIFY CORRECT EXECUTION

�����-���

NO CORRELATION CORRELATED

Left boundary,right boundary,& occurrenceappear in thescript view

NOTE: This is the same script used in Lesson 8

Page 458: Lr7web Book 04a

10-12 LoadRunner for the Web 7.0

10

12

3. VERIFY CORRECT EXECUTION

�����,������

Nocorrelation Correlated

NOTE: This is the same script used in Lesson 8

Page 459: Lr7web Book 04a

Automatic Correlation During Recording 10-13

10

13

AUTOMATIC CORRELATION DURING RECORDING

����� ����,����.7/

2. Click Add Rule

The CorrelationRules dialog opens

• <New Rule 1> isadded to theRules list

• user may edit therule name

1. Click Define Rules

Page 460: Lr7web Book 04a

10-14 LoadRunner for the Web 7.0

10

14

AUTOMATIC CORRELATION DURING RECORDING

����� ����,����.9/

• Parameterize token in link/form action text– user defines boundaries– alternate right boundary (optional)– instance (optional)

• Parameterize value extracted from cookie– value is extracted from cookie text– looks for cookie text in links/form and actions/form

fields– no boundaries needed

• Parameterize form field value– enter or select field name to parameterize

3. Select an Action (type of rule)

Page 461: Lr7web Book 04a

Automatic Correlation During Recording 10-15

10

Add right and left boundaries - for the left boundary you may specify “End of String” or “Newline Character” in addition to “User-defined Text.” You may also specify an alternate right boundary.

Instance - specify which occurrence of the search text to parameterize

Match case - makes the search for boundaries case sensitive

Reverse search - look for left boundary from end of the string backwards

Parameter prefix - prevent overwriting existing user parameters; easier to recognize the parameter in your script; standardize parameter names

Always create new parameter - create a new parameter for this rule even if the value replaced the parameter has not changed from the previous instance. This option should be set if the Web server assigns the token a different value for each page. For example, NetDynamics servers may change the session ID from page to page to minimize fraud.

15

AUTOMATIC CORRELATION DURING RECORDING

����� ����,����.:/

– Right of (boundary)– Left of (boundary)– OR (alternate right

boundary)– Instance– Match Case– Reverse Search– Parameter Prefix– Always create new

parameter

4. Select other options as needed

Page 462: Lr7web Book 04a

10-16 LoadRunner for the Web 7.0

10

16

AUTOMATIC CORRELATION DURING RECORDING

����� ����,����.?/

5. Test the rule

• The parameterized source textappears in the Substitution Result box

If substitution occurred:

C. Click Test

B. Enter text in theSource string forsubstitution box

A. Click Test

• The parameters created and their substituted values are color-coded in both windows

• A list of the rules applied appears in the Applied Rules box

Page 463: Lr7web Book 04a

Automatic Correlation During Recording 10-17

10

17

������

• Correlate dynamic values during recording when:– web application server can be automatically detected– session has a known context– you can determine rules for correlation

• Correlation during recording is accomplished usingCorrelation Recording Options

Page 464: Lr7web Book 04a

10-18 LoadRunner for the Web 7.0

10

Page 465: Lr7web Book 04a

Part 4: Advanced Topics

Page 466: Lr7web Book 04a
Page 467: Lr7web Book 04a

Custom Output Messages 11-1

Custom Output Messages

Page 468: Lr7web Book 04a

11-2 LoadRunner for the Web 7.0—Advanced

11

2

��!������

In this lesson, you will learn how to:• Determine why a Vuser failed• Add logic and decision-making to a Vuser script• Enhance Vuser output logs• Send parameter values to output logs• Use the Continue on error run-time setting

Page 469: Lr7web Book 04a

Custom Output Messages 11-3

11

3

������� �����-���������$��%

• Return code of the Check statement• Value of an input parameter• Error message• Transaction status

Enhance Vuser Output Logs

Page 470: Lr7web Book 04a

11-4 LoadRunner for the Web 7.0—Advanced

11

4

&��������'�� �� �����������

(� ��� �������� �' ��#��

REVIEW

Confirms that all business processescomplete properly while the serverhandles concurrent usage.

Page 471: Lr7web Book 04a

Custom Output Messages 11-5

11

5

Image

Did a search engine returnexpected matches?

Did the news site displaythe picture?

Example usage

�������"����2�

Check

REVIEW

Text

Page 472: Lr7web Book 04a

11-6 LoadRunner for the Web 7.0—Advanced

11

By examining the output log, the LoadRunner Expert can see that the cor-rect order number was not sent back from the Web server.

6

-��"�������4��� ����+������2��������

. . .Action1.c(15):Transaction Login started.

. . .Action1.c(46):Transaction Login ended with Pass status (Duration: 1.7090).Action1.c(47):The test step: "Submit Form: reservation.pl" succeeded.Action1.c(54):Transaction InsertSalesOrder started.Action1.c(55):Starting Step - "Submit Form: SalesOrder".Action1.c(57)Transaction DB_InsertOrder started.

. . .Action1.c(65):Transaction DB_InsertOrder ended with Pass status (Duration: 3.6320).Action1.c(66):The test step: "Submit Form: reservation.pl" succeeded.Action1.c(68):ERROR: Text Check : VerifyOrderNumber - Failed :

Expected "1234", but found ""Starting iteration 2. [MsgId: MMSG-15970]Action1.c(13):Starting Step - "URL: Order Entry Module".Action1.c(15):Transaction Login started.

. . .

OUTPUT LOG

REVIEW

Page 473: Lr7web Book 04a

Custom Output Messages 11-7

11

7

�����8��$����� �����& ��%

• Why did the check fail (in greater detail)?

• What was the input data for that iteration?

• What dynamic values were captured during thatiteration?

Action1.c(15):ERROR: Text Check: VerifyOrderNumber - Failed :Expected "1234", but found ""

Page 474: Lr7web Book 04a

11-8 LoadRunner for the Web 7.0—Advanced

11

You can make the output log more informative by modifying the Vuser script with LoadRunner functions and variables.

8

0 �� ��-�����������#���

1. Capture the return code of the Check statement.

Page 475: Lr7web Book 04a

Custom Output Messages 11-9

11

9

web _image_check

web _find

LR_PASSCheck Status

���2�������� ���,��� ���-����

LR_PASS

LR_FAILLR_PASS equals 0LR_FAIL equals 1

Page 476: Lr7web Book 04a

11-10 LoadRunner for the Web 7.0—Advanced

11

The declaration statement may go either inside or outside the brackets of Action1(). In this example, the variable rc (“return code”) is defined as an integer. This is done because LR_PASS and LR_FAIL are integer values. On playback, the return code is stored in rc where it can be accessed by the script and your code.

10

web_find ("Verify_Order_Number", "RightOf=Order No.:,", "LeftOf=, has been processed", "what=1234", LAST);

7)��������,��� ��� ���"�������2�������� �

rc =

1.1 Declare aninteger variable tocapture the returncode of the check

int rc;....

1.2 Assign theresult of the checkstatement to thevariable

Page 477: Lr7web Book 04a

Custom Output Messages 11-11

11

11

0 �� ��-�����������#���

1. Capture the return code of the Check statement.

2. Compare the return code to LR_FAIL.

Page 478: Lr7web Book 04a

11-12 LoadRunner for the Web 7.0—Advanced

11

■ Create a condition to check whether the value of the return code (rc) matches an LR_FAIL status.

■ Follow C programming syntax when editing the Vuser script.

12

9)��������,��� ��� ����#,D(��#

rc = web_find ("Verify_Order_Number", "RightOf=Order No.:,", "LeftOf=, has been processed", "what=1234", LAST);

if (rc == LR_FAIL)

NOTE: Comparisons require "==",and assignments require "=".

Page 479: Lr7web Book 04a

Custom Output Messages 11-13

11

13

0 �� ��-�����������#���

1. Capture the return code of the Check statement.

2. Compare the return code to LR_FAIL.

3. If return code == LR_FAIL, send a problemdescription to the output log.

Page 480: Lr7web Book 04a

11-14 LoadRunner for the Web 7.0—Advanced

11

The lr_error_message statement takes a formatted string and sends it to the Vuser output log.

The first character of the format argument is always a percent sign (%). The last character of format is a letter code that determines the type of for-matting. One or more format modifiers can appear between the first and last character of the format argument (see below). The possible letter codes are as follows:

c Prints a character from its decimal ASCII code.d Prints the decimal integer portion of a number.e Converts input to scientific notation.f Pads with zeros to the right of the decimal point.g Prints a decimal value while suppressing non-significant zeros.o Prints the octal value of the integer portion of a number.s Prints an unmodified string.x Prints the hexadecimal value of the integer portion of a number.% Prints a literal percent sign (%).

14

lr_error_message ("string");

:)��"�GG#,D(��#C��� �+�����8������� �����������#��

Use

• A formatted string, which isthe message to be sent to theOutput window

• You may use the standardformatting conventions whichare available for printf in C

Page 481: Lr7web Book 04a

Custom Output Messages 11-15

11

Add the lr_error_message statement describing the error in the condi-tion that checks for the FAIL status of the return code.

You can also use the statement lr_set_debug_message to toggle output logging on and off. Using this function may be preferable to changing log-ging in the Run-Time Settings dialog, because you can turn it on for a sin-gle step if you want. The syntax is:

lr_set_debug_message(type, ON|OFF);

■ type may be either extended or brief.

■ ON = 1; OFF = 0.

15

lr_error_message ("Order Number was not sent from server." );

lr_error_message ("Check that Vendor was correct." );

OrderClerk.c(3):ERROR: Order Number was not sent from server.

:)��"�GG#,D(��#C��� �+�����8������� �����������#��

OrderClerk.c(4):ERROR: Check that Vendor was correct.

Page 482: Lr7web Book 04a

11-16 LoadRunner for the Web 7.0—Advanced

11

16

:)��"�GG#,D(��#C��� �+�����8������� �����������#��

lr_error_message ("Check that Vendor was correct." );lr_error_message ("Order Number not sent from server." );

{if (rc == LR_FAIL)

rc = web_find ("Verify_Order_Number", "RightOf=Order No.:,", "LeftOf=, has been processed", "what=1234", LAST);

Page 483: Lr7web Book 04a

Custom Output Messages 11-17

11

17

0 �� ��-�����������#���

1. Capture the return code of the Check statement.

2. Compare the return code to LR_FAIL.

3. If return code == LR_FAIL, send a problemdescription to the output log.

4. Transform input parameters to output messages.

Page 484: Lr7web Book 04a

11-18 LoadRunner for the Web 7.0—Advanced

11

18

lr_eval_string ( "{parameter name}");

?)��� �"���� ����+�������� ������������������

• Name of parameter whosevalue you want to retrieve

• This function returns a stringrepresentation of the value ofa specified parameter

Use

Page 485: Lr7web Book 04a

Custom Output Messages 11-19

11

In this example, “%s” indicates that the format of the parameter is string. Note that, by default, a parameter in a Vuser script is enclosed by { }. How-ever, the character that encloses a parameter can be changed by the user.

The lr_eval_string returns the data in the data file as a string, which can then be printed out to the output log via the lr_error_message state-ment.

19

OrderClerk.c(5):ERROR: Vendor: 7832

lr_error_message ("Vendor: %s", );lr_error_message ("Material No.: %s", );

lr_eval_string("{Vendor}" )lr_eval_string("{Material_Nm}" )

?)��� �"���� ����+�������� ������������������

OrderClerk.c(6):ERROR: Material No.: ST-34922

Page 486: Lr7web Book 04a

11-20 LoadRunner for the Web 7.0—Advanced

11

20

?)��� �"���� ����+�������� ������������������

lr_error_message ("Order Number not sent from server." );{if (rc == LR_FAIL)

lr_error_message ("Check that Vendor was correct." );

lr_error_message ("Vendor: %s", lr_eval_string("{Vendor}" ) );

lr_error_message ("Material No.: %s", lr_eval_string("{Material_Nm}"));

Page 487: Lr7web Book 04a

Custom Output Messages 11-21

11

21

0 �� ��-�����������#���

1. Capture the return code of the Check statement.

2. Compare the return code to LR_FAIL.

3. If return code == LR_FAIL, send a problemdescription to the output log.

4. Transform input parameters to output messages.

5. Stop execution of the Vuser.

Page 488: Lr7web Book 04a

11-22 LoadRunner for the Web 7.0—Advanced

11

The body of a Vuser is actually a C function called Action1 by default. As noted in the Action Files lesson, that function can be renamed by the user. As in C, the return statement returns a value and stops the function execu-tion which ultimately stops the Vuser’s iteration.

22

return (value);

=)������01����� ��"�����-���

Use

A numeric code which specifieshow VuGen will stop execution

(0) Stops the current iteration(-1) Stops the Vuser entirely

Page 489: Lr7web Book 04a

Custom Output Messages 11-23

11

23

���������� ��"������� �����-��������� ���'��%

Use return(0); if the Vusercan recover from the failure bystarting the next iteration andusing different data

The Vendor number doesn’t workwith the warehouse number, sothe business process will fail

Web site’s default page could notload

Use return(-1); if the erroris fatal, such that the Vusercannot continue to run

Page 490: Lr7web Book 04a

11-24 LoadRunner for the Web 7.0—Advanced

11

24

=)������01����� ��"�����-���

{if (rc == LR_FAIL)

return(0);}

lr_error_message ("Order Number not sent from server." );

lr_error_message ("Check that Vendor was correct." );

lr_error_message ("Vendor: %s", lr_eval_string("{Vendor}" ) );

lr_error_message ("Material No.: %s", lr_eval_string("{Material_Nm}"));

Page 491: Lr7web Book 04a

Custom Output Messages 11-25

11

25

0 �� ��-�����������#���

1. Capture the return code of the Check statement.

2. Compare the return code to LR_FAIL.

3. If return code == LR_FAIL, send a problemdescription to the output log.

4. Transform input parameters to output messages.

5. Stop execution of the Vuser.

6. Enable the run-time setting: Continue on error.

Page 492: Lr7web Book 04a

11-26 LoadRunner for the Web 7.0—Advanced

11

26

�� �� ���� �0�

• By default, VuGen and Controller stop an iterationwhen an error occurs

• Continue on error allows the Vuser to executesucceeding statements (if possible)

• Also allows you to program logic into your Vuser– optional business process navigation– re-submit a form

Page 493: Lr7web Book 04a

Custom Output Messages 11-27

11

27

F)�0 ������ ������� ����� �

• In that case, anyoutput messagestatements are notexecuted, becausethey follow thefailed check

• If Continue onerror is not set,LoadRunner stopsan iteration themoment a checkfails

Page 494: Lr7web Book 04a

11-28 LoadRunner for the Web 7.0—Advanced

11

■ If Continue on error is disabled in this example, the “if” statement would not be executed. The iteration would stop the moment the web_find function failed.

■ If Continue on error is enabled and an error occurs, an error message is sent to the output log and the Vuser continues running, if possible.

■ As a rule, Continue on error should be disabled. This setting should be made decisively. If the Vuser were composed of context sensitive statements, during playback the execution would continue after an error but the Vuser would no longer be emulating a real user. In that case the test results would be skewed.

28

F)�0 ������ ������� ����� �

Execution

Execution

rc = web_find ("Verify_Order_Number", "RightOf=Order No.:,", "LeftOf=, has been processed", "what=1234", LAST);

if (rc == LR_FAIL){

}

lr_error_message ("Order Number ...lr_error_message ("Check that ...lr_error_message ("Vendor: %s",…

return(0);

STOP

lr_error_message ("Material No.: %s",…

Page 495: Lr7web Book 04a

Custom Output Messages 11-29

11

29

�'��������� ������� ������� ����� �

Enable Continue on error only whenmaking output logs more informative oradding logic to the Vuser.Otherwise, undesired results may occur.

WARNING

RULEOF

THUMB

Page 496: Lr7web Book 04a

11-30 LoadRunner for the Web 7.0—Advanced

11

Because the Vuser script is a C program, you can add any C function to it or use any C constructs (e.g., for-loop, while-loop, etc.). LoadRunner Experts might want to add more logic to the Vuser to control multiple page navigation, or to add a loop that re-submits a form when the server is busy.

30

+���� ����������������int rc;. . . . . . .. . . . . . .rc = web_find ("Verify_Order_Number",

"RightOf=Order No.:,", "LeftOf=, has been processed", "what=1234", LAST);

if (rc == LR_FAIL){

lr_error_message ("Order Number not sent from server." );lr_error_message ("Check that Vendor was correct." );

lr_error_message ("Vendor: %s", lr_eval_string("{Vendor}" ) );lr_error_message ("Material No.: %s", lr_eval_string("{Material_Nm}"));

}return(0);

Page 497: Lr7web Book 04a

Custom Output Messages 11-31

11

31

������

• Determine the reason a Vuser failed• Capture check statement return codes• Add logic and decision-making to the Vuser script• Enhance Vuser output logs

– insert problem description based on return code– insert parameter values

• Use the Continue on error run-time setting

Troubleshoot failed Vusers

Page 498: Lr7web Book 04a

11-32 LoadRunner for the Web 7.0—Advanced

11

Page 499: Lr7web Book 04a

Custom Output Messages 11-33

11

Exercises

Exercise A: Returning an Informative Error Message

Exercise objective: To create a Vuser able to return a more informative error mes-sage if it fails to submit a flight reservation request successfully.

Record Vuser to Book a FlightRecord a Vuser script that signs in, purchases a flight, and verifies that the reser-vation request was successful.

1. Create a new Web Vuser in VuGen, and begin recording.

2. Sign in to the demo Web site.

3. Click the CONTINUE button on the FLIGHT FINDER page.

4. Click the CONTINUE button on the SELECT FLIGHT page.

5. Type in a name and card number on the BOOK A FLIGHT page, then click SECURE PURCHASE.

6. Insert a text checkpoint to verify the text “Your itinerary has been booked” on the FLIGHT CONFIRMATION page.

7. Click SIGN-OFF.

8. Stop recording.

9. Save the Vuser as: \web_project\Vusers\Lab11original

Page 500: Lr7web Book 04a

11-34 LoadRunner for the Web 7.0—Advanced

11

Edit the Vuser Script 1. Save the script again as: Lab11vuser1

2. Switch to Script View to see the Vuser script as text.

Which statement verifies that the flight reservation request was successful?

________________________________________________________________________

To make output logs more informative, for what type of statement would you want to monitor the return code? Why?

________________________________________________________________________

________________________________________________________________________

How can you capture the return code?

________________________________________________________________________

________________________________________________________________________

Where in your Vuser script do you need to initialize your return code variable? What is the data type of the return code variable?

________________________________________________________________________

________________________________________________________________________

3. Initialize rc as the variable to capture your return code.

4. Assign the return code of the web_find statement to rc.

What return code value indicates that the check failed? What return code value indicates that the check succeeded?

________________________________________________________________________

Page 501: Lr7web Book 04a

Custom Output Messages 11-35

11

What condition should you use to decide whether you need to return an output message?

________________________________________________________________________

What statement can you use to send a message to the Execution Log?

________________________________________________________________________

What value should you return to stop an iteration?

________________________________________________________________________

5. Insert logic to send a message and stop the iteration if the check fails.If the web_find fails, your script should return the following error message:

”Business Process error. Flight was not purchased.”

After returning the message, the code should stop the current iteration.

6. Run the modified script to verify correct execution.

Break here for class discussion.

Page 502: Lr7web Book 04a

11-36 LoadRunner for the Web 7.0—Advanced

11

Reconfigure the Server Options 1. Open the demo Web server in your browser. (Don’t record this.)

2. Sign in as admin with password mercury.

3. Reconfigure the server options.On the MERCURY TOURS ADMINISTRATION page, check the box next to Data-base Error.Click the SUBMIT button.

4. Close the browser after the Sign-in page reappears.

Verify Correct Execution 1. Make sure that the Run-Time Settings conform to those in the following table:

Why is it necessary to select Continue on error in the Run-Time Settings?

________________________________________________________________________

2. Play back the Vuser script.

3. Review the Test Results.

Did the first iteration pass? How many iterations did VuGen run?

________________________________________________________________________

TAB SETTING

Pacing set Iteration count to 2

Preferences Check Verification checks

General select Continue on error

Page 503: Lr7web Book 04a

Custom Output Messages 11-37

11

When an iteration failed, what page was returned instead of the FLIGHT CON-FIRMATION page?

________________________________________________________________________

The Web server returned an error page in response to which submit statement?

________________________________________________________________________

________________________________________________________________________

What line in the Execution Log was returned by your error message statement?

________________________________________________________________________

4. When you have finished examining the results, close the Test Results window, the Run-Time Viewer, and the Vuser.

5. Reset the demo Web server to its default state.Sign in as admin with password mercury.Make sure that all boxes are unchecked, then click SUBMIT.

!

Page 504: Lr7web Book 04a

11-38 LoadRunner for the Web 7.0—Advanced

11

Review: Custom Output Messages

Test your understanding of this lesson by answering the following questions:

1. For what purpose should you select Continue on error?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

2. When would you want to stop an iteration? When would you want to stop a Vuser?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

3. If your Vuser script had two parameters, “DepartCity” and “ArrivalCity,” how could you have the Vuser script return an error message which included the city names?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 505: Lr7web Book 04a

Understanding Record and Playback 12-1

Understanding Record and Playback

Page 506: Lr7web Book 04a

12-2 LoadRunner for the Web 7.0—Advanced

12

2

��!������

In this lesson, you will learn:• VuGen’s mechanism of recording• The difference between URL and HTML

recording and replay• Advantages and disadvantages of URL and

HTML recordings

• How to make use of multiple actions withinone Vuser

Page 507: Lr7web Book 04a

Understanding Record and Playback 12-3

12

HTML and URLRecording Modes

Page 508: Lr7web Book 04a

12-4 LoadRunner for the Web 7.0—Advanced

12

4

-��� �,�� � ���� ��

There are two ways to record:

• HTML (browser/context sensitive)

• URL (HTTP/analog)

Set the recordingmode in RecordingOptions before youstart recording

REVIEW

Page 509: Lr7web Book 04a

Understanding Record and Playback 12-5

12

5

����-��� �,�� �����+,�>�����

2. VuGen stores the page returned by the serverin the Record Proxy cache.

1. VuGen launches the browser with a web_urlrequest to capture the HTTP requests that are sent.

Page 510: Lr7web Book 04a

12-6 LoadRunner for the Web 7.0—Advanced

12

During recording, VuGen traps all HTTP traffic by using its own record proxy. When you begin recording in VuGen, you must specify the root URL of the Web site under test. VuGen then:

■ launches the browser on the desktop.

■ sets the browser’s proxy settings to the VuGen record proxy, so the browser will send all HTTP requests to the record proxy during recording.

■ sets the record proxy settings of the original/native proxy so that the HTTP request can be forwarded from the record proxy to the native proxy server.

After this process is complete, when the browser requests the root page to be sent from the server, the HTTP request goes through the record proxy for recording. Responses also pass through the record proxy for display in the browser.

Note: If there isn’t a native proxy server, the record proxy will just send all HTTP requests to the Web server.

6

RecordProxy

©1999 Microsoft Corporation. All rights reserved.

VUGEN RECORDING PROCESS

4�����#�� �� �� �+�1�������

1. VuGen launches the browser with a web_urlrequest to capture the HTTP requests that are sent.

NativeProxy

http://www.hotmail.com

:(%

6(59(5

Page 511: Lr7web Book 04a

Understanding Record and Playback 12-7

12

Once an HTTP request is sent to the server, the resulting page that is sent back for display is also saved in the record proxy cache. VuGen will always save the last page sent from the server in its cache. The following slides discuss why VuGen does that.

7

R E G I S T E R E D U S E R S

Enter

Login Name Password

Frames No Frames My Default

V I S I T O R S I N F O

cache

RecordProxy

VUGEN RECORDING PROCESS

,��� � �+�������� �� �����

2. VuGen stores the pagereturned by the server inthe Record Proxy cache.

NativeProxy

©1999 Microsoft Corporation. All rights reserved.

http://www.hotmail.com

:(%

6(59(5

Page 512: Lr7web Book 04a

12-8 LoadRunner for the Web 7.0—Advanced

12

Comparing the two statements, notice that the web_submit_data state-ment recorded the Action object, the request method and the hidden data field. This ensures that on playback, web_submit_data sends all items embedded in the statement to the server, and the server retrieves the nec-essary information to send the resulting page.

How does the web_submit_form play back such that the Web server knows the necessary information to send the resulting page?

8

���#���)�',#�.7/

web_submit_form("start",ITEMDATA,

"name=user", "value=steve", ENDITEM,"name=password", "value=dude", ENDITEM,

LAST);

web_submit_data("start","Action=login.asp","Method=POST",ITEMDATA,

"name=user", "value=steve", ENDITEM,"name=password", "value=dude", ENDITEM,"name=sessionID", "value=15379", ENDITEM,

LAST);

URL

HTML

Page 513: Lr7web Book 04a

Understanding Record and Playback 12-9

12

9

���#���)�',#�.9/

HTML Statement• Some necessary information not included in new request• VuGen searches cache for result of last request• If cached information matches new request, VuGen recordsweb_submit_form

URL Statement• Contains all information necessary to complete new request• Memory is not searched• VuGen records web_submit_data

Page 514: Lr7web Book 04a

12-10 LoadRunner for the Web 7.0—Advanced

12

Because web_submit_form relies on the result of the last request to be in memory, it must succeed the appropriate step or it won’t play back cor-rectly. This means that it is a context sensitive statement. It must be replayed in the context of the result of the last statement.

10

���#�������� ��

Statements that can be executed only withinthe context of the last request

Page produced bylast HTTP Request

It MUST be presentfor Context Sensitivestatements to playback

STATEMENT CACHED DATA

ActionMethodHidden Data

web _submit_form

Action(name of link)web _link

Action(name of image)web _image

Page 515: Lr7web Book 04a

Understanding Record and Playback 12-11

12

Playback begins with the web_url statement:

1. The web_url statement sends a request to the Web server. web_url is an analog statement. Therefore, the URL was hard-coded during record-ing, and that recorded URL was sent to the server during playback.

2. The Web server processes the request and sends an HTML page back to VuGen. VuGen caches the returned page’s source HTML. Notice that the session ID returned by the server during the first playback (15380) was different than the session ID that was recorded (15379). The recording and the playback each took place during different Web server sessions.

11

HOW DOES VUGEN PLAY BACK STATEMENTS?

',#�01�����B����D��

web_url("www.hotmail.com", "URL=http://www.hotmail.com/", "TargetFrame=_TOP", LAST);web_submit_form("start",

ITEMDATA,"name=user", "value=steve", ENDITEM,"name=password", "value=dude", ENDITEM,

LAST);

...<Form Action=login.aspMethod="POST"><input name=user value=""><input name=password value=""><input name=sessionIDvalue=15380></Form>...

HTTP Request1

Result of HTTP Request

2

:(%

6(59(5

Page 516: Lr7web Book 04a

12-12 LoadRunner for the Web 7.0—Advanced

12

Playback continues with the context sensitive web_submit_form state-ment:

1. VuGen first checks the cache for the values needed by the web_submit_form statement: action, method and hidden data.

2. The values are in the cache, so VuGen retrieves them. In this example the action, method and hidden data values were login.asp, POST, and sessionID = 15380 respectively.

3. VuGen sends the web_submit_form statement with the retrieved values to the server.

4. The server processes this request and returns the next page, which is then cached in turn.

The playback of the context sensitive statement was successful even though the sessionID was dynamic, because the data were not hard-coded.

12

HOW DOES VUGEN PLAY BACK STATEMENTS?

���#�01�����B����D������D"��

web_submit_form("start",ITEMDATA,

"name=user", "value=steve", ENDITEM,"name=password", "value=dude", ENDITEM,

LAST);

Result of HTTP Request

4

2login.aspPOSTsessionID=15380

1Action?Method?Hidden data?

NEW PAGE REPLACES OLDPAGE

:(%

6(59(5

POST login.asp HTTP/1.1user=stevepassword=dudesessionID=15380

3

Page 517: Lr7web Book 04a

Understanding Record and Playback 12-13

12

What if the second statement played back had been analog rather than con-text sensitive? In that case, it would have been web_submit_data rather than web_submit_form. Also, the action, method, and hidden data would have been hard-coded in the script.

1. The originally recorded action, method, and hidden data values are sent back to the server (in this example, login.asp, POST, and sessionID= 15379). Because the web_submit_data statement had all the information needed to make the request, VuGen did not query the cache for the values. The hidden value for sessionID, 15379, that was originally recorded was sent to the server regardless of the value just returned by the server for this new session.

2. The server returns an error page to the browser (and to VuGen’s cache). During playback the server expected sessionID=15380 (not 15379), because this was a new server session, with an id that was different than the one when the recording took place.

In this case playback was not successful.

13

HOW DOES VUGEN PLAY BACK STATEMENTS?

',#�01�����B����D������D ���

web_submit_data("start","Action=login.asp","Method=POST",ITEMDATA,

"name=user", "value=steve", ENDITEM,"name=password", "value=dude", ENDITEM,"name=sessionID", "value=15379", ENDITEM,

LAST);

Result of HTTP Request

2ERROR! Session ID’s do not match!

cache is not searched

POST login.asp HTTP/1.1user=stevepassword=dudesessionID=15379

1

:(%

6(59(5

Page 518: Lr7web Book 04a

12-14 LoadRunner for the Web 7.0—Advanced

12

14

• They are retrieved from memory during playback• If they are dynamic, the Vuser still runs• Script is as big as business process–one step per

page

4� �"�����"����#�,�� � �

REDUCES NEED TO CAPTURE DYNAMIC VALUES

Action tag values and hidden data are NOT hardcoded

Page 519: Lr7web Book 04a

Understanding Record and Playback 12-15

12

15

Memory (cache) is searched during playback• Requires more memory• Requires more CPU power

8��� �� �������"����#��� � �

SCRIPTS ARE LESS SCALABLE

Page 520: Lr7web Book 04a

12-16 LoadRunner for the Web 7.0—Advanced

12

16

• Scripts are about more scalable than HTML scripts

• Support for Java Applets and ActiveX objects onthe page

• Ability to replay on Unix

4� �"�����"�',#�,�� � �

FLEXIBILITY AND SCALABILITY

Page 521: Lr7web Book 04a

Understanding Record and Playback 12-17

12

17

• Scripts require more correlation (nothing isretrieved from cache)

• Context-sensitive checks won’t work (parser isdisabled)*

• Scripts are large (all images and frames arerecorded as separate step

8��� �� �������"�',#�,�� � �

MORE CORRELATION REQUIRED

* Use web_reg_save_param to search for specific text

Page 522: Lr7web Book 04a

12-18 LoadRunner for the Web 7.0—Advanced

12

Multiple Action Filesin a Vuser

Page 523: Lr7web Book 04a

Understanding Record and Playback 12-19

12

19

������������� �(������ �� ��-���

Reasons to put multiple action files into one Vuser:

• Emulate real users from User Profile

• Record application login and logout separatelyfrom other user actions

• Iterate some action files more frequently thanothers ("weighting")

Page 524: Lr7web Book 04a

12-20 LoadRunner for the Web 7.0—Advanced

12

20

���������������� �����������

Webserver

Internet

Login

Select item 1 & putin shopping cart.Select item 2 & putin shopping cart.

Do Login once

Do checkout once

Do all 3tasks in1 Vuser

Checkout

Select item& put in cartmany times

1

2

3

Page 525: Lr7web Book 04a

Understanding Record and Playback 12-21

12

21

-����������� ��

Login(recordingoptional)

vuser_init.c

User Actions(Business Processes)

Action1.c, Action2.c, etc.(e.g., Select item & put in shop-ping basket, Checkout)

This section may be iterated (repeated)during one test run

Logout(recordingoptional)

vuser_end.c

Page 526: Lr7web Book 04a

12-22 LoadRunner for the Web 7.0—Advanced

12

22

������������� �(������ �� ��-���

• Record Login in vuser_init

• Record shopping cart actions in Action1

• Record Checkout in Action2

• Record Logout in vuser_end

Page 527: Lr7web Book 04a

Understanding Record and Playback 12-23

12

23

������������� �(������ �� ��-���

1. Start recording

2. Select action file

3. Record actions

4. Repeat steps 2 and 3 as necessary

5. Stop recording

Page 528: Lr7web Book 04a

12-24 LoadRunner for the Web 7.0—Advanced

12

24

���� �(����������� ��;��>�� ��������������� 1. Open Run-Time Settings, Pacing tab.

5. Double-click anaction file.

2. Right-click "Run,"and select"Properties."

3. Select "Sequential"from Run logic listand click OK.

4. Right-click "Run"again, and select"Insert Actions."

Page 529: Lr7web Book 04a

Understanding Record and Playback 12-25

12

The default Random percents is equal percentages for each action. In the above example, that is 50% for each of the two.

25

���� �(����������� ��;,� �������������

2. Select "Random"from Run logic listand click OK.

1. In Run-Time SettingsPacing tab, right-click"Run," and select"Properties."

Page 530: Lr7web Book 04a

12-26 LoadRunner for the Web 7.0—Advanced

12

In practice, you should iterate a Vuser many more than the minimum number of times to ensure that accurate weighting is accomplished.

26

���� �(����������� ��;,� �������������

5. Repeat for otheraction files. Totalfor all action filesmust be 100%.

4. Type a percent andclick OK.

6. Set Iteration countappropriately.

3. Right-click 1staction file andselect "Properties."

This Vuser needsat least 3 iterationsto make accurateweighting more

probable

Page 531: Lr7web Book 04a

Understanding Record and Playback 12-27

12

NOTE: If VuGen crashes during recording:

1. Go to your browser’s LAN settings.

2. Make sure that Use a proxy server is either unchecked or set to the right port.

If Use a proxy server is checked and set to a local port, you won’t be able to connect to the internet!

27

������

• Data in an HTTP request may be hidden and dynamic

• In HTML recording mode VuGen stores pages returned bythe server in its cache

• HTML statements retrieve data from cache– if data is dynamic, Vuser still replays– less need to capture dynamic values

• HTTP statements contain all necessary information– more scalable– more work required to make scripts replay

• Multiple action files in a Vuser– may emulate real users better– allow action file "weighting"

Page 532: Lr7web Book 04a

12-28 LoadRunner for the Web 7.0—Advanced

12

Page 533: Lr7web Book 04a

Understanding Record and Playback 12-29

12

Review Questions

Multiple Actions in One Vuser

1. What are the benefits of creating multiple actions within a Vuser?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Different Types of Data

2. Why do Web developers use hidden data when creating interactive Web sites?

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

HTTP Requests

3. What information is typically sent in an HTTP request?

________________________________________________________________________

________________________________________________________________________

Page 534: Lr7web Book 04a

12-30 LoadRunner for the Web 7.0—Advanced

12

4. What are the different ways a Web developer can create an HTTP request?

________________________________________________________________________

________________________________________________________________________

5. During recording, what is saved in the record proxy cache?

________________________________________________________________________

________________________________________________________________________

6. VuGen can parse HTML in memory. True or False?

________________________________________________________________________

Recording Process

7. When does VuGen record a web_submit_data instead of a web_submit_form? Why? (Be as specific as possible.)

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

Page 535: Lr7web Book 04a

Understanding Record and Playback 12-31

12

Playback Process

8. During the playback of a web_submit_form, where do the values of the action, method, and hidden fields come from?

________________________________________________________________________

9. Provide a definition of a context sensitive statement. Be specific.

________________________________________________________________________

________________________________________________________________________

________________________________________________________________________

10. What is the benefit of context sensitive statements in a Vuser?

________________________________________________________________________

________________________________________________________________________

Page 536: Lr7web Book 04a

12-32 LoadRunner for the Web 7.0—Advanced

12

Page 537: Lr7web Book 04a

IP Spoofing 13-1

IP Spoofing

Page 538: Lr7web Book 04a

13-2 LoadRunner for the Web 7.0—Advanced

13

2

��!������

In this lesson, you will learn:

• How load balancing systems function• How routing tables and load balancing systems

use IP addresses• The importance of IP spoofing to load testing• How to implement IP spoofing in LoadRunner

Page 539: Lr7web Book 04a

IP Spoofing 13-3

13

IP-SpecificLoad Balancing Systems

Page 540: Lr7web Book 04a

13-4 LoadRunner for the Web 7.0—Advanced

13

Some systems employ load balancing configurations to maximize overall speed and efficiency. Such systems typically use the IP address of the orig-inating client to distribute a request.

4

����,���� ���"��������� �,�>����������+<�����

Internetusers

255.7.144.1

203.33.0.253

121.10.199.25

A load balancing system may distributerequests to application servers and backenddatabases according to the client IP address

Loadbalancingsystem

Routers

Databases

Applicationservers

Webserver

Page 541: Lr7web Book 04a

IP Spoofing 13-5

13

Every IP packet is forwarded by hubs, routers, and Web servers by means of a routing table.

5

��������+�� ������'�� ���,���� ��������%

Routing tables identify a packet’s next step bylooking up the destination IP address

Page 542: Lr7web Book 04a

13-6 LoadRunner for the Web 7.0—Advanced

13

Routers, like hubs and Web servers, know where to send a packet of infor-mation by referencing the final destination in its internal routing table and retrieving the IP address of the packet’s next step.

6

Web server

,���� ���������'���8���� ���� � �������(� ���+�2��H��*�1������

Client

25.20.255.200

Routers

101.101.101.1

33.33.33.33

7.77.77.7

2.2.2.222

101.101.101.1 33.33.33.3395.96.97.9 9.1.91.19144.4.4.44 33.33.33.33

80.8.80.88 9.1.91.191

56.5.65.6 2.2.2.222212.1.21.212 2.2.2.222

Destination Next step

ROUTER 7.77.77.7Routing Table

This packet from25.20.255.200 needs

to get to 101.101.101.1.Where should Isend it next?

To33.33.33.33!

Page 543: Lr7web Book 04a

IP Spoofing 13-7

13

The results of a Web query must be forwarded by the Web server back to the query’s originator. The client’s IP address is indexed in the Web server’s routing table.

In the example above, the client at 25.20.255.200 sent a request to the Web server (101.101.101.1), and the request was passed along to the appropriate application and database servers. Their results were sent back to the Web server, which looked up the originating client’s IP address, 25.20.255,200, in its routing table. Here the Web server found that packets to that client should be sent to router 33.33.33.33.

7

Routers

Databases

Applicationservers

Webserver

����������'����������� �H��+�� �������,��� �,������

Client25.20.255.200

33.33.33.33

7.77.77.7

2.2.2.222

155.1.1.55

12.10.251.210 53.53.55.595.96.97.9 9.1.91.191

25.20.255.200 33.33.33.33

8.18.90.89 9.1.91.191

56.117.65.6 2.2.98.721.16.21.212 98.2.2. 22

Destination Next stop

WEB SERVER 101.101.101.1Routing Table

101.101.101.1

This packet is aresponse to a request

from 25.20.255.200.Where should Isend it next?

To33.33.33.33!

Page 544: Lr7web Book 04a

13-8 LoadRunner for the Web 7.0—Advanced

13

Load balancing systems also use the client IP address to direct queries.

8

��������+�� ������'�� ���#�� �4��� � ���������%

Load balancing systems specify a backend serverbased on the IP address which sent the request

Page 545: Lr7web Book 04a

IP Spoofing 13-9

13

Each request is sorted by IP address to a backend destination. In this example, requests from the three browsers were distributed to three dif-ferent database servers based on their IP addresses.

9

#�� �4��� � ����������,����� �����+�� �����"��������� �

Virtual users withIP Spoofer

200.37.66.9

144.100.105.88

103.14.255.200

Requests from 200.37.66.9

go to DatabaseServer 1

Requests from 144.100.105.88go to Database

Server 3

Requests from103.14.255.200go to Database

Server 2

Loadbalancingsystem

Routers

Databases

Applicationservers

Webserver

Page 546: Lr7web Book 04a

13-10 LoadRunner for the Web 7.0—Advanced

13

If, during load testing, all requests appear to be originating from a single IP address (or a narrow range of IP numbers) the load may not be distrib-uted realistically through various parts of the system.

10

-������'������ ������,��� �������� �����+�� ���

Virtualusers

200.37.66.9200.37.66.9200.37.66.9

200.37.66.9

Virtual users at one IP address createunrealistic load on routers, applicationservers, and backend databases

Loadbalancingsystem

Routers

Databases

Applicationservers

Webserver

Page 547: Lr7web Book 04a

IP Spoofing 13-11

13

An unbalanced load test may invalidate some, if not all, of the test results.

11

' ���� � �#�� ��� ��� ��������' ���� ������,������

EXAMPLES

Virtual users mayfail unrealistically

Page 548: Lr7web Book 04a

13-12 LoadRunner for the Web 7.0—Advanced

13

Implementing IP Spoofingwith LoadRunner

Page 549: Lr7web Book 04a

IP Spoofing 13-13

13

The IP Spoofer feature of LoadRunner is unnecessary when testing sys-tems without IP-dependent load balancing.

13

Do I needIP spoofing?

�+�����"� ��������

• Yes, if your system uses IP-dependent load balancing

Page 550: Lr7web Book 04a

13-14 LoadRunner for the Web 7.0—Advanced

13

Because the IP Wizard configures a host machine to employ multiple IP addresses, the wizard must be run on every Vuser host machine.

14

�+�����"� ��������

• Yes, if your system uses IP-dependent load balancing

How do I implementIP spoofing?

• Run the IP Wizard on eachVuser load generator

• Enable the IP Spoofer fromthe Controller’s mainmenu

• Disable modem emulationin the Run-Time Settings

Do I needIP spoofing?

Page 551: Lr7web Book 04a

IP Spoofing 13-15

13

By inputting the Web server’s IP address, the IP Wizard can compare this address with the client IP addresses. If they do not reside on the same net-work, updates to the routing table are required.

If the Web server’s IP address is not entered, the server’s routing table must be manually updated by executing scripts named at the end of the wizard. In practice, it is simpler to enter the server’s IP address at this point.

15

�����+�����

Invoke IP Wizard from the LoadRunner program group

• IP Wizard Step 1 - Select "New Settings"

• IP Wizard Step 2 - Enter IP address of Web server

This step isnecessary forautomaticupdating of theWeb server’srouting table

TIP

Page 552: Lr7web Book 04a

13-16 LoadRunner for the Web 7.0—Advanced

13

Clicking the Add button allows the user to enter IP addresses to be “spoofed” during scenario execution. Confirm address validity with the network administrator.

16

�����+�����

Invoke the IP Wizard from theLoadRunner program group

• IP Wizard Step 1 -Select "New Settings"

• IP Wizard Step 2 -Enter IP address of Web server

• IP Wizard Step 3 -Add IP addresses thatwill load balance yoursystem

Page 553: Lr7web Book 04a

IP Spoofing 13-17

13

If testing an intranet or a small LAN system, enter a range of numbers to represent users on this closed system. Select Class A, B, or C according to the numbering convention used on the network.

17

� �� �� ��I#�*�� �����

Enter a range ofIP addressesrepresentingnodes on a LAN

199 . 199 . 1 . 0199 . 199 . 1 . 1199 . 199 . 1 . 2199 . 199 . 1 . 3

Your networkadministratorcan providevalid IPaddresses foryour network

TIP

199 . 199 . 0 . 0hostidnetid

2 bytes define network;2 bytes define client nodes.

Class B Example

199 . 0 . 0 . 0hostidnetid

1 byte defines the network;3 bytes define client nodes.

Class A Example

199 . 199 . 199 . 0netid hostid

3 bytes define the network;1 byte defines up to 256 client nodes.

Class C Example

Page 554: Lr7web Book 04a

13-18 LoadRunner for the Web 7.0—Advanced

13

To simulate usage from many parts of the Internet, select the “Don’t use any of these” option and enter several completely unique IP addresses. Consult the network administrator responsible for the load balancing sys-tem to learn which IP addresses can be used to create a balanced load across the entire system.

18

� �� �� ���� �����

44 . 233 . 10 . 66199 . 137 . 108 . 141230 . 5 . 36 . 17588 . 17 . 166 . 205

Enter individual IPaddresses to representInternet clients

Internet testing

Page 555: Lr7web Book 04a

IP Spoofing 13-19

13

To ensure an automatic update of the Web server’s routing table, check the appropriate box at the end of the wizard.

19

�����+�����

Invoke the IP Wizard from theLoadRunner program group

• IP Wizard Step 1 -Select "New Settings"

• IP Wizard Step 2 -Enter IP address of Web server

• IP Wizard Step 3 -Add addresses that will loadbalance your system

IP Wizard Summary -Check Reboot now toupdate routing tables.This ensures that theWeb server rememberspaths to virtual clients.

Page 556: Lr7web Book 04a

13-20 LoadRunner for the Web 7.0—Advanced

13

After the Web server has been rebooted, open the Controller and enable the IP Spoofer from the Scenario menu.

20

������� �� �������+�����"�

Select Enable IP Spoofer from the Controller’sScenario menu

Page 557: Lr7web Book 04a

IP Spoofing 13-21

13

21

������� �� �������+�����"�

Make sure that Bandwidth is set to maximum inRun-Time Settings

Page 558: Lr7web Book 04a

13-22 LoadRunner for the Web 7.0—Advanced

13

During load testing with the IP Spoofer enabled, requests seem to origi-nate from a spectrum of client addresses. Consequently, the entire system is realistically tested.

22

�+�����"� ��,�������� ����<8�������� �#�� ��� ��� �

Virtual users withIP Spoofer

200.37.66.9144.100.105.88191.230.1.0

103.14.255.200

Virtual users from many "spoofed" IPaddresses create realistic load on entiremulti-tiered system

Loadbalancingsystem

Routers

Databases

Applicationservers

Webserver

Page 559: Lr7web Book 04a

IP Spoofing 13-23

13

23

������

• Emulates real-world network traffic• Associates each Vuser with a different IP address• Is configured by running the IP Wizard• Must be configured separately on every Vuser

load generator

IP spoofing

• Used by routing tables to determine an IPpacket’s path

• Used by load balancing systems to divide a loadamong several backend servers

IP addresses

Page 560: Lr7web Book 04a

13-24 LoadRunner for the Web 7.0—Advanced

13

Page 561: Lr7web Book 04a

Appendix: Answers to Questions A-1

Appendix: Answers to Questions

This appendix contains answers to all of the exercise questions and the review questions at the end of each exercise.

Page 562: Lr7web Book 04a

A-2 LoadRunner for the Web 7.0

A

1 - Review: Planning an Effective Load Test

1. What are some of the ways you could have obtained the information shown in the Task Distribution Diagrams?

■ consult experienced users, managers, system experts, and Web developers

■ get statistics from the system

2. How does the information in a Task Distribution Diagram help you to build a Transaction Mix?

It shows you where the peak loads occur and what transactions occur during that time.

3. What information is gathered in the Transaction Mix that is not displayed in the Task Distribution Diagram?

Business risk (should the business process fail), database usage, and Web server activity.

4. Where would you get the additional information (not in the Task Distribution Diagram) which appears in the Transaction Mix?

■ database usage from database administrators

■ risk to business enterprise from managers

■ Web usage from the server experts

5. What criteria would you use to select Web transactions for load testing?

■ processes with high throughput

■ processes which create heavy database activity

■ processes which present a high risk to the company if they should fail

Page 563: Lr7web Book 04a

Appendix: Answers to Questions A-3

A

2 - Actions

Exercise A: Create a Web Vuser

Was the site under test invoked successfully by VuGen?

Yes.

Why is it necessary for VuGen to invoke the browser?

In order to capture the communication between the browser and the server for correct playback, VuGen must launch the browser.

In VuGen, what is it that indicates that the login was recorded?

A step called “com.mercurytours.servlet.SignonServlet” was added to the icon tree.

Was the Flight Confirmation page received from the Web server?

Yes.

Was the Vuser added to the framework?

Yes.

In light of the information gathered from the Transaction Mix, why is Book-Flight considered a key business process to automate for load testing?

BookFlight showed heavy database usage and high business risk.

In the Test Results window, what indicates that the Vuser run passed?

The Results Summary page shows “Passed” in its Results column, and a green check mark appears next to the Test Summary icon in the tree pane.

Page 564: Lr7web Book 04a

A-4 LoadRunner for the Web 7.0

A

Was an image of the Flight Confirmation page captured by the Test Results?

Yes.

What are the file name and extension of the file that displays the test results?

Results.qtp

To what do the messages in the Execution Log refer?

The Execution Log messages refer to the Vuser’s communication with the server.

Review: Actions

1. For what purpose are Vusers created?

Vusers are created to:1. emulate real users2. apply load to the system

2. What tools does VuGen provide to help you analyze Vuser run results?

1. Execution Log2. Run-Time Viewer3. Test Results window.4. HTML View5. Snapshot Results window

Page 565: Lr7web Book 04a

Appendix: Answers to Questions A-5

A

3 - LoadRunner Transactions

Exercise A: Add a Transaction During Recording

Based on the lesson presented and the planning specification, why would you want to add a LoadRunner transaction for the Display Itinerary process?

You would want to measure the performance of the server(s) when the query for a flight itinerary is sent to the database.

How many flight reservations are listed in the itinerary?

2.

In the Execution Log, how long did the display_itinerary transaction take in seconds?

It should be less than one second unless you have an old machine. The exact time will vary depending on your hardware, your network, and whether or not the Run-Time Viewer was displayed during playback.

Exercise B: Add a Transaction After Recording

How long did the sign-in transaction take in seconds?

It should be less than one second unless you have an old machine. The exact time will vary depending on your hardware, your network, and whether or not the Run-Time Viewer was displayed during playback.

Page 566: Lr7web Book 04a

A-6 LoadRunner for the Web 7.0

A

Review: LoadRunner Transactions

1. What is the purpose of a LoadRunner transaction?

To measure one or more steps/user actions of a business process.

2. What is the purpose of measuring a business process from start to end?

To compare total transaction time with measurements on specific steps in the business process. This will aid in finding areas causing bottlenecks.

3. What is the easiest way to get measurements for each step of a recorded script? For an entire action?

In the Automatic Transactions frame of the General tab in the Run-Time Settings dialog, check:

■ Define each action as a transaction

■ Define each step as a transaction

Page 567: Lr7web Book 04a

Appendix: Answers to Questions A-7

A

4 - Exercises: Verification Checkpoints

Why is it recommended to add verification checks to your Vusers?

You would want to verify, using LoadRunner, that the business process is func-tioning as expected under load.

Exercise A: Add Verification Checkpoints to a Vuser

Was the flight confirmation page returned from the Web server?

Yes.

What other visual cues indicate that the reservation was created successfully?

The message “Your itinerary was booked!” appeared on the Flight Confirmation page.

Was the text check added? How do you know?

Yes. In VuGen an icon was added to the tree.

What is the name of the flight confirmation image? Write the file name (includ-ing the file extension) in the space below.

mast_confirmation.gif

Was the image check added to the icon tree?

Yes.

Why do you think you were asked to put the image check after the End Trans-action step, rather than after the ConfirmFlight step?

If it is included within the transaction, then the execution time of the checkpoint is added to the execution time of the step the transaction is supposed to measure, thus making the results inaccurate.

Page 568: Lr7web Book 04a

A-8 LoadRunner for the Web 7.0

A

Did the Vuser execute successfully?

Yes.

How does the Iteration 1 Summary show that the checks passed? How would it show a check failure?

Green text and words such as “succeeded” and “successful” in the Details column of the checkpoint row. Red text would indicate a verification failure.

Are the key words from the Iteration Summary page also present on the check-point pages?

Yes.

Review: Verification Checkpoints

1. What is a good reason to verify functionality under load with checkpoints?

It’s possible that a heavy load could cause a server to return errors rather than correct information.

2. How do you determine which visual cues to verify during load testing?

Consult a Functional Expert or use your judgment as to what visual cue provides evidence that the business process is working as expected.

Page 569: Lr7web Book 04a

Appendix: Answers to Questions A-9

A

5 - Data Parameterization

Exercise A: Create Vuser to Sign Up New User

Was the sign up successful? What indicates that you have successfully created a new user account with Mercury Tours?

Yes.

The Mercury Tours REGISTER page confirms the new account has been accepted and displays the new user name.

Were you able to sign in with the new username and password? How can you tell?

Yes.

The FLIGHT FINDER page appeared.

In the VuGen icon tree, what action does the sign-in link step represent?

It represents the user clicking the sign-in text in the “Thank you” message.

What was the result of the Vuser execution?

Vuser execution failed.

Which step in the execution tree failed?

The VerifyNewAccount checkpoint step failed.

What information appears in the Details column of the VerifyNewAccount page of the Test Results?

“Step failed. 0 occurrences of ‘Thank you for registering’ found.”(Assuming that you used a text check to verify “Thank you for registering.”)

Page 570: Lr7web Book 04a

A-10 LoadRunner for the Web 7.0

A

What error message was displayed in the Execution Log?

“VerifyNewAccount failed. 0 occurrences of ‘Thank you for registering’ found.”(Assuming that you used a text check to verify “Thank you for registering.”)

What was written on the line preceding the error message in the Execution Log?

“web_submit_form was successful”

What step preceded VerifyNewAccount in the Test Results window?

Web Submit Form: NewUserInfo

Was there an error message displayed on the captured page for the Web Submit Form: NewUserInfo step? If yes, what was the message?

Yes. “The user name has already been used, please enter a new name.”

How could you solve the problem revealed by the error message on the cap-tured Web Submit Form: NewUserInfo page?

Parameterize userName, password, and confirmPassword, and put unused data into the data file for these parameters.

Exercise B: Parameterize Fields with Unique Data Constraints

What is an input field with a unique data constraint?

A field with unique constraints prohibits the insertion of data values which already exist in the database for that field. The field accepts each data value once and only once. Once a value is inserted for that field, it cannot be inserted again.

In the RegisterNewUser action, which fields do you think are likely to have unique data constraints?

userName, password, and confirmPassword.

Page 571: Lr7web Book 04a

Appendix: Answers to Questions A-11

A

In the icon tree, which step contains the new user information?

NewUserInfo

From the table in the Data tab, list the field name and the value for each field with unique data constraints.

What is the suggested data file name in the File path box?

username.dat

Why should you replace “sal” in the data file?

Because sal has already been used in the unique field.

What is the value of Select next row in the Parameter Properties dialog? Based on this value, in what order would you expect VuGen to use the data in user-name.dat?

Sequential.

VuGen will use the first data row for iteration 1 of the Vuser, data row 2 for itera-tion 2, etc.

What happened to the value “sal” that was in the userName field in the Submit Form Step Properties dialog?

It was replaced by the parameter {username}.

What is the suggested data file name in the File path box?

password.dat

FIELD VALUE

userName sal

password chevy

passwordConfirm chevy

Page 572: Lr7web Book 04a

A-12 LoadRunner for the Web 7.0

A

Refer to the Submit Form Step Properties dialog. Which field uses the same data as the password field?

confirmPassword.

Was the parameter “password” assigned to the field confirmPassword?

Yes.

Did the Vuser iterate successfully? What were the results of each iteration in the Test Results window?

Yes. The result was “Passed” for each iteration.

Was a new user name created for each iteration?

Yes.

Did the Execution Log list the parameters you created and the values for each parameter during each iteration?

Yes.

Exercise C: Parameterize to Avoid Server Caching

Did the Vuser iterate successfully 4 times?

Yes.

Did a different Vuser sign in each iteration?

Yes.

Page 573: Lr7web Book 04a

Appendix: Answers to Questions A-13

A

Exercise D: Parameterize a Text Check

In what situation would you want to parameterize a text check?

Parameterize a text check in instances when the value to be checked changes with each iteration, and is referenced from an input value or a parameter.

Did the cardnumber text check pass for each iteration?

Yes.

Exercise E (Optional): Database Issues

What were the results of the run?

All 3 iterations failed.

Why did the run fail each time?

The database allows a user/password combination to be created only once.

One way to avoid the problem encountered in this exercise is to create unique data for every script run. What is a better way to avoid the problem?

Refresh the database between runs.

Page 574: Lr7web Book 04a

A-14 LoadRunner for the Web 7.0

A

Review: Data Parameterization

1. Why do you need to parameterize fields in your Vuser scripts?

■ to ensure successful playback by addressing problems of unique or date con-straints

■ to exercise the server and avoid caching by using different data for each itera-tion

2. List the reasons why parameterization is necessary when load testing the Web server and the database server.

Parameterization allows you to use different data for each iteration of your Vus-ers, emulating real user load. Emulating real user load will provide more mean-ingful results for analysis of your load test.

3. Who is the person on the project team who can give you valid data necessary for Vusers with parameterized fields?

The Functional User. The functional user is any person knowledgeable about the application under test. This person might be a developer, an in-house trainer, or an end-user.

4. How can data caching have a negative effect on load testing results?

When data is cached in the server’s memory, the server does not need to fetch it from the database during playback. Then, test results do not reflect the same per-formance they would if real users were loading the system with different data.

Page 575: Lr7web Book 04a

Appendix: Answers to Questions A-15

A

6 - Manual Scenarios

Exercise A: Create and Run a Manual Scenario

What is the script Type?

QTWeb

Why do you want to save all messages?

So they may be examined after the test run in Vuser output windows.

Who would you consult for advice on which Windows NT counters to set?

The IT person in charge of the server(s).

What is the benefit of having the Windows Resources Monitor?

You can keep monitoring the Load Generator ’s system resource usages in real-time and locate any bottleneck on a particular machine.

Which transaction had the highest average response time?

BookFlight_Transaction.

Why should you remove BookFlight_Transaction from the graph when looking for top time transactions?

Because BookFlight_Transaction measures the entire action. Top time transac-tions measure only a step or a group of steps.

Does the graph show any spikes now? If yes, which transaction(s) caused the spikes?

com.mercurytours.servlet.WelcomeServlet. That is the first step of the script, the one that sends the URL and causes the server to return the home page.

Page 576: Lr7web Book 04a

A-16 LoadRunner for the Web 7.0

A

Exercise B: Load Testing

How many passed and failed transactions does the Transaction Summary show? What percentage of all transactions failed?

All, or nearly all, transactions should pass.

What do you notice about the Busy and Idle Servers lines in the Apache graph?

Each line is the inverse or complement of the other.

What do you notice about the graph now?

You might notice that several different transactions show spikes.

What is a reason to scale the load from 20 to 25 Vusers?

To isolate hardware and software that might limit scalability.

How much did the transaction response time vary as more Vusers were added?

In most cases, average response time was significantly higher for 25 Vusers than for 20 Vusers.

How much did the average throughput decline as more Vusers were added?

Very little, if any.

Overall, do you think that the difference between 25 and 20 Vusers was small enough that you would feel confident allowing the higher load on your sys-tem?

Yes.

Page 577: Lr7web Book 04a

Appendix: Answers to Questions A-17

A

Review: Manual Scenarios

1. Why is it a good practice to run just a few Vusers the first time?

There’s no point running a load test if there is a problem running the scenario with just a few Vusers.

2. Why do the transaction measurements not matter when testing multiple Vusers to make sure they can run concurrently without errors?

Because you are not conducting a load test of the system. You are only verifying that the scenario will run with more than one Vuser.

Page 578: Lr7web Book 04a

A-18 LoadRunner for the Web 7.0

A

7 - Goal-Oriented Scenarios

Exercise A: Create a Goal-Oriented Scenario

On what factors will you base your decisions for hits per second, minimum and maximum Vusers?

Based on Task Distribution.

Which monitor should you select to watch progress towards the scenario goal?

Hits per second.

Did the scenario achieve your hits per second goal? How do you know?

Yes.1) The Scenario Status (in the Run tab) showed 25+ hits/second.2) The Controller automatically stopped the run, and there were no errors.

Analyze the graph to see if you can determine how transaction response times were affected by the number of hits.

Response time appeared to increase and decrease in tandem with the number of hits per second.

Review: Goal Scenarios

1. What Run-Time Settings can you use to help emulate real users?

(1) Check Replay think time in the Think Time tab.(2) Bandwidth Settings in the Browser Emulation tab.

2. Why run more Vusers than your anticipated peak load?

To find out how scalable your system is.

Page 579: Lr7web Book 04a

Appendix: Answers to Questions A-19

A

8 - Manual Correlation

Exercise A: Create Vuser to Book a New Flight

Which step includes the input steps for the fly from and fly to cities?

web_submit_form(“....Reservation.Servlet”)

Did the Vuser iterate 4 times?

Yes.

In the Test Results, did any iteration fail? If yes, which iterations failed?

Iterations 2, 3, and 4 failed.

What was the name of the first step where an iteration failed?

The failed step was: web_submit_form(...Purchase.Servlet)

Based on the lesson presented, why do you think iterations 2, 3, and 4 failed while iteration 1 passed?

That usually indicates dependent data in the script.

Exercise B: Recreate Vuser and Compare with Original

Why do you think that only one data value should be changed for the 2nd recording?

To learn whether that value has any data dependent on it.

What differences did you find between the two files at the step that failed?

login.x, login.y, fromPort, toPort, findFlights.x, findFlights.y, outFlight, inFlight, reserveFlights.x, reserveFlights.y, buyFlights.x, and buyFlights.y.

Page 580: Lr7web Book 04a

A-20 LoadRunner for the Web 7.0

A

Which difference(s) should be captured for playback? Give a reason for your answer.

Only the values for outFlight and inFlight because (1) they appeared in the failed step, PurchaseServlet, and (2) the other differences in that step, reserveFlights.x and reserveFlights.y, were mouse click values which not reused in the script. The mouse click values in the other steps don’t matter; they were not reused either.

Why should you copy the outFlight AND inFlight values when only the out-Flight input value changed from Lab8vuser1 to Lab8vuser2?

Because both values changed in Lab8vuser2. Both values must be dependent on the cities selected.

Exercise C: Fix the Vuser Script

In the example shown in the graphic, what part of the string is dynamic and should be captured?

This answer is for the example only: Blue Skies Airlines$200$244$5:03 pm$ This is not the value you should look for

Which step submits the flight details? Which step causes the server to send the page with the flight details form?

PurchaseServlet, ReservationServlet

What is the error message in the Execution Log?

“Requested form not found”

What is the message on the previous line of the log?

“web_submit_form was successful”

What is the name of the step immediately preceding the PurchaseServlet step?

web_submit_form . . . ReservationServlet

Page 581: Lr7web Book 04a

Appendix: Answers to Questions A-21

A

Would “value=” be a good left boundary? Give a reason for your answer.

No, because “value=” is repeated many times throughout the script, often in places having nothing to do with dynamic values.

What is the left boundary?

outFlight value=”

What is the right boundary?

$”>

How will you determine the correct occurrence of the left boundary?

Repeat the find for the left boundary in the Execution Log until the dynamic value following the boundary matches the one you copied from WDiff to Notepad.

Which line did the cursor jump to?

web_submit_form(“....Reservation.Servlet”)

How can you verify that Lab8vuser3 captured the values correctly?

1st, check the Test Results to see that there were no failures during the run.2nd, check the Execution Log to see what values were used for parameter substi-tution.

What flight numbers and ticket prices did Lab8vuser3 insert?

ITERA-TION OUT_DATA IN_DATA

1 Blue Skies Airlines$630$270$5:03 pm$ Unified Airlines$363$303$18:53 pm$

2 Blue Skies Airlines$720$478$5:03 pm$ Unified Airlines$273$557$18:56 pm$

3 Blue Skies Airlines$800$1330$5:03 pm$ Unified Airlines$83$1403$18:59 pm$

4 Blue Skies Airlines$910$706$5:03 pm$ Unified Airlines$193$761$18:02 pm$

Page 582: Lr7web Book 04a

A-22 LoadRunner for the Web 7.0

A

Review: Lesson 8-Manual Correlation

1. How can parameterizing a recorded Vuser script expose data dependencies?

If two fields are data dependent and either of them is parameterized, then using unsynchronized data in either field will break the script.

2. What usually indicates that your Vuser script has dynamic data which is depen-dent on your parameterized fields?

If all iterations fail except for the one which used the recorded data values.

3. What technique should you use to find dynamic dependent data caused by parameterization?

1. Record with different data (for a parameterized field).2. Use WDiff to compare the two recordings.

Page 583: Lr7web Book 04a

Appendix: Answers to Questions A-23

A

9 - Automatic Correlation After Recording

Did the Vuser script play back successfully?

No.

Did the first iteration use the same fromPort and toPort as when you first recorded? Did the first iteration succeed?

Yes. Yes.

Which iterations failed? What does this usually indicate?

Iterations 2, 3, and 4. It usually indicates dependent values hard-coded in the script.

Which step failed in the iterations that failed?

Web Submit Form: . . . PurchaseServlet

What was the error message displayed on the page for that step in Test Results?

“Step creation failed.”

Which iteration will you choose for comparison with the recorded Reservation-Servlet step?

Iteration 2, 3, or 4.

What differences between the recorded and replayed text did the Correlation Results tab display?

Correlation Results displayed the differences for the outFlight and the inFlight dynamic values, which includes the airline, flight number, price, and time.

Was the correlation successful? How could you tell?

Yes. A green check mark appeared at the left end of both lines in the Correlation tab.

Page 584: Lr7web Book 04a

A-24 LoadRunner for the Web 7.0

A

What changes did automatic correlation make to the script?

Correlation added 4 lines to the script, above the . . .ReservationServlet step:(1) a comment, beginning: “//WCSPARAM WCSParam_Diff1Studio.... (2) a web_reg_save_param statement to save the outFlight information(3) another comment, similar to the first one(4) web_reg_save_param statement to save the inFlight informationIn addition, it replaced the 2 dynamic values in the PurchaseServlet step with 2 parameter names: {WCSParam_Diff1} and {WCSParam_Diff2}

Did all 4 iterations pass this time?

Yes.

Review: Automatic Correlation After Recording

1. Why do you need at least one playback for automatic correlation after recording to work properly?

The VuGen requires something to compare to the recorded information. The only place it can get it is from information captured during a playback.

Page 585: Lr7web Book 04a

Appendix: Answers to Questions A-25

A

11 - Custom Output Messages

Which statement verifies that the flight reservation request was successful?

web_find(. . .VerifyFlightConfirm)

To make output logs more informative, for what type of statement would you want to monitor the return code? Why?

The statement that verifies the business process, in this case, the web_find(. . .) statement. Monitoring that statement should help to identify any problems the Vuser has with a particular set of data.

How can you capture the return code?

Assign the result of web_find to a variable, e.g., rc = web_find(...);

Where in your Vuser script do you need to initialize your return code variable? What is the data type of the return code variable?

At the top of the script, right after the #include statement.int (for integer)

What return code value indicates that the check failed? What return code value indicates that the check succeeded?

LR_FAIL. LR_PASS.

What condition should you use to decide whether you need to return an output message?

if (rc == LR_FAIL)

What statement can you use to send a message to the Execution Log?

lr_error_message

Page 586: Lr7web Book 04a

A-26 LoadRunner for the Web 7.0

A

What value should you return to stop an iteration?

return (0);

Why is it necessary to select Continue on error in the Run-Time Settings?

So that the if statement will be executed. Otherwise, VuGen would stop the iter-ation immediately after the web_find failed.

Did the first iteration pass? How many iterations did VuGen run?

Yes. 2.

When an iteration failed, what page was returned instead of the FLIGHT CON-FIRMATION page?

The “YOU ENCOUNTERED AN ERROR” page.

The Web server returned an error page in response to which submit statement?

Web Submit Form: . . . PurchaseServlet2

What line in the Execution Log was returned by your error message statement?

It should have returned:”Business Process error. Flight was not purchased.”

Review: Custom Output Messages

1. For what purpose should you select Continue on error?

Set it only when you want VuGen to execute some code you have added to send more information to the Execution Log, to branch according to the value of a return code, etc.

Page 587: Lr7web Book 04a

Appendix: Answers to Questions A-27

A

2. When would you want to stop an iteration? When would you want to stop a Vuser?

■ Stop an iteration if the Vuser can recover by beginning a new iteration.

■ Stop a Vuser if the Vuser cannot continue to run correctly.

3. If your Vuser script had two parameters, “DepartCity” and “ArrivalCity,” how could you have the Vuser script return an error message which included the city names?

lr_error_message(“The flight from %s to %s was not booked”, (lr_eval_string(“{DepartCity}”), lr_eval_string(“{ArrivalCity}”));

Page 588: Lr7web Book 04a

A-28 LoadRunner for the Web 7.0

A

12 - Understanding Record and Playback

Review Questions

Multiple Actions in One Vuser

1. What are the benefits of creating multiple actions within a Vuser?

They allow you to perform different business processes in one Vuser to represent a real user who does the same thing. They let you build Vusers that emulate real users defined in the User Profile. They also allow you to record the login and logoff separately from the business process actions and thus avoid iteration.

Different Types of Data

2. Why do Web developers use hidden data when creating interactive Web sites?

Developers use hidden data fields to maintain a preferred state during the user’s Web session. Web sites might behave differently, send different pages, or change access privileges according to the data values in hidden fields. For example, a hid-den field might identify a user as a preferred customer. Preferred customers might be entitled to special offers not displayed to non-preferred customers.

HTTP Requests

3. What information is typically sent in an HTTP request?

The version of HTTP, the objects which are either to be sent back or to handle data, the method of the request (e.g., POST), server type and version, content length, etc.

4. What are the different ways a Web developer can create an HTTP request?

The properties of an HTTP request can be set via HTML, JavaScript, Java Applets, ActiveX controls, or any third-party program.

Page 589: Lr7web Book 04a

Appendix: Answers to Questions A-29

A

5. During recording, what is saved in the record proxy cache?

The HTML page returned from the server as a result of the previous HTTP request.

6. VuGen can parse HTML in memory. True or False?

True.

Recording Process

7. When does VuGen record a web_submit_data instead of a web_submit_form? Why? (Be as specific as possible)

A web_submit_data is recorded when VuGen cannot match the action, method, data fields, and/or hidden data values with the page that is stored in the record proxy cache. Comparison failures are typically caused by something other than HTML setting the properties of the HTTP request. Because VuGen can parse only HTML, it cannot find all the properties of the HTTP request in memory. This results in the hard-coding of all the request information in a web_submit_data statement.

Playback Process

8. During the playback of a web_submit_form, where do the values of the action, method, and hidden fields come from?

During playback, the result of the last request is saved in memory. The values are retrieved from VuGen’s memory.

Page 590: Lr7web Book 04a

A-30 LoadRunner for the Web 7.0

A

9. Provide a definition of a context sensitive statement. Be specific.

Context sensitive statements are statements which can be executed only within the context of the last request. Because much of the HTTP request data is retrieved from memory, the context sensitive statements must be executed immediately after the correct, previous request. For example, web_submit_form relies on the result of the last request, so the page produced by that request must be in com-puter memory when web_submit_form is executed.

10. What is the benefit of context sensitive statements in a Vuser?

Because much of the HTTP request data is retrieved from memory, less hard-coded data is recorded. As a result, the necessity for capturing and parameteriz-ing hard-coded, dynamic data is reduced.

Page 591: Lr7web Book 04a

Appendix: Test Specifications B-1

Appendix: Test Specifications

This appendix collects all the “test specifications” that appear in various lessons throughout the book.

Page 592: Lr7web Book 04a

B-2 LoadRunner for the Web 7.0

Page 593: Lr7web Book 04a

Appendix: Test Specifications B-3

Overview

Your company, Mercury Tours, is a medium-sized travel and tours company. As part of its campaign to increase sales, Mercury Tours plans to expand its travel and tours business into e-commerce. An external Web site has been built to serve its customers via the Internet.

The system has been built, customized and configured. It is stable. Everything works for one user. Now load testing can begin.

As the LoadRunner Expert, it is your responsibility to use LoadRunner’s VuGen and Controller to create the required load on the system. In addition to creating the required load, you will also use LoadRunner’s analysis tools to assess the results.

In the following pages, we will present information about the system to be load tested in the form of a Planning Specification. The Planning Spec. is intended to represent the sort of documentation you would have to put together yourself if it were a real life situation. After each lesson, a portion of the Planning Spec. will be followed by some exercises. You will need the information contained in the Plan-ning Spec. to do the exercises.

Page 594: Lr7web Book 04a

B-4 LoadRunner for the Web 7.0

Planning Specification

Flight Application Web Site Usage

6 am 9 am3am 12pm 3 pm 6pm 9pm

system backup

TOTAL

Source: Mercury Tours MIS Dept.

12

TASK DISTRIBUTION FOR NORMAL BUSINESS DAY

search for flights13 15 30 17 25 22 17

display itinerary12 16 15 30 19

delete reservation11 12 11

book a flight16 18 14 18 30 19

11 12 15 11 11register new user account

13 23 31 76 46 29 112 82 28

Page 595: Lr7web Book 04a

Appendix: Test Specifications B-5

6 am 9 am3am 12pm 3 pm 6pm 9pm

system backup

TOTAL

Source: Mercury Tours MIS Dept.

12

TASK DISTRIBUTION FOR PRE-HOLIDAY TRAVEL

search for flights

display itinerary

delete reservation

book a flight

register new user account

24 20 50 40 30 70 70 50

30 30 20 50 36 24

4 2 8 2

16 30 24 40 36 24

4 30 20 40 16 20

24 70 144 40 96 208 158 120

Page 596: Lr7web Book 04a

B-6 LoadRunner for the Web 7.0

Transaction Mix

Business Process Name

Normal Day Peak Thruput

Pre-Holiday Peak Thruput

System Usage DB Usage Risk

Search for flight

25 70 business process processed from the client side, generates server activity

heavy low

Display itinerary

30 50 business process processed from the client side, query for existing flight reservations generates server activity

heavy med

Book a flight

30 40 generates activity in the database server, returns server output to con-firm business process completion

heavy high

Delete flight res-ervation

12 8 generates activity in the database server, returns server output to con-firm business process completion

low low

Create new user account

15 40 adds new member to the customer database, user may proceed to mem-ber login

low high

Page 597: Lr7web Book 04a

Appendix: Test Specifications B-7

Selected Transactions to AutomateMercury Tours has determined the three key business processes for load testing.

BUSINESS TRANSACTION NORMAL LOAD PEAK LOAD

Display Itinerary 30 50

Book a flight 30 40

Create New User Account

15 40

Page 598: Lr7web Book 04a

B-8 LoadRunner for the Web 7.0

Page 599: Lr7web Book 04a

Appendix: Test Specifications B-9

Planning Specification (continued):

Display Itinerary

USER ACTIONS EXPECTED RESULTS

1 Invoke the Web browser, typehttp://localhost/servlets/com.mercurytours .servlet.WelcomeServlet for the URL address, and press the Enter button.

The Mercury Tours home page appears.

2 Type a valid user name in the User Name box.

The typed characters are dis-played in the User Name box.

3 Type a valid password in the Password box. The user’s password appears as a series of asterisks in the Pass-word box.

4 Click the Sign-In button. A query is sent to the database to match an existing value for regis-tered user name and password. If a match is found, the Mercury Tours FLIGHT FINDER page appears.

5 After the FLIGHT FINDER page appears, click the ITINERARY button.

A Query is sent to the database to search for all flights reserved for the logged in user name. The ITINENARY page appears and displays all values returned by the database in response to the query.

Page 600: Lr7web Book 04a

B-10 LoadRunner for the Web 7.0

Planning Specification (continued):

Create New User Account

USER ACTIONS EXPECTED RESULTS

1 Click the REGISTER button. The REGISTER page appears.

2 In the REGISTER page, type the information for creating a new user.Fields in red may not be left blank.

Customer information is dis-played in the fields:- First Name- Last Name- Phone- E-mail- Address- City- State- Postal Code- Country- User Name- Password- Confirm Password

3 Click the Submit button. The new user is added into the database and the Mercury Tours REGISTER page appears with confirmation.

Page 601: Lr7web Book 04a

Appendix: Test Specifications B-11

Planning Specification (continued):

Book a Flight

USER ACTIONS EXPECTED RESULTS

1 Invoke the Web browser, typehttp://localhost/MercuryWebTours/ for the URL address and press Enter.

The Mercury Tours home page appears.

2 Type the name in the User Name box. The member’s login name appears in the Member name box.

3 Type the password in the Password box. The member’s password appears as a string of asterisks in the Password box.

4 Click the Sign-In button. The Mercury Tours FLIGHT FINDER page appears.

5 Type the following data in the indicated fields on the FLIGHT FINDER page.

The Find Flight page appears with the following flight information fields:- Type- Passengers- Departing From- On- Arriving In- Returning- Service Class- Airline

6 Click the CONTINUE button. The SELECT FLIGHT page appears and returns all values of available flights.

7 Select the first available flight and click the CONTINUE button.

The BOOK A FLIGHT page appears.

8 Type the following data in the indicated fields on the BOOK A FLIGHT page.

- First Name- Last Name- Number

Page 602: Lr7web Book 04a

B-12 LoadRunner for the Web 7.0

9 Click the SECURE PURCHASE button. The FLIGHT CONFIRMATION page appears. It contains confir-mation of the reserved flight, and the flight and customer details.

10 Verify that the FLIGHT CONFIRMATION page appears, and that the page contains the text “Your itinerary has been booked!”.

11 Verify the flight number. Flight details appear in the FLIGHT CONFIRMATION page.

USER ACTIONS EXPECTED RESULTS

Page 603: Lr7web Book 04a

Appendix: Scaling the Web C-1

Appendix: Scaling the Web

This appendix contains technical notes about hardware and operating system requirements and configuration for large scale load testing.

Page 604: Lr7web Book 04a

C-2 LoadRunner for the Web 7.0

C

Scaling the Web: Large Scale Load Testing with LoadRunner

Highly active and large scale Web systems require load test simulations of thou-sands of virtual users in order to accurately quantify the performance of the test system prior to deployment. Unfortunately, large numbers of simulated users require more hardware, raising the cost for load testing large systems. Thus, a cost-effective test bed that supports large numbers of users is important for both scalability and manageability. This article delineates important decision and con-figuration issues in designing a cost-effective test bed for hosting 1,000 to 100,000 Web Virtual Users (running in Analog mode).

Perhaps the most important first step is deciding whether to use Unix or PC. Con-trary to the general propensity to use Unix, PC Windows systems are more scal-able given LoadRunner’s architecture. This is largely because PC Virtual Users are thread-based, and Unix Virtual Users are process-based. Table A shows the resource requirements for Unix and Windows for Web Vusers that submit HTTP requests and contain reasonable levels of think-time between HTML pages (e.g., 5-15 seconds of random think-time).

Based on the above resource requirements, the Windows NT/2000 platform would be ideal for hosting large numbers of Vusers for less cost. However a single instance of Windows NT/2000 can support only 1,500 to 2,000 Virtual Users due to limited “handle” resources (i.e., threads, files, sockets, etc.) per OS session. In order to circumvent this limitation Windows should be equipped with Terminal Sessions.

■ Windows 2000 w/ Microsoft Terminal Server (MTS) - MTS comes with Win-dows 2000 Server; however, licenses from Microsoft must to be purchased.

■ Windows NT 4.0 w/ Citrix Server - Citrix Server is a separate package that

Web Vusers 100 Vusers 1,000 Vusers

10,000 Vusers

50,000 Vusers

Windows NT/2000 23 MB 230 MB 2.3 GB 23 GB

Unix 400 MB 4 GB 40 GB 400 GB

Table A: RAM requirements for Analog Web Vusers under Unix and Windows

Page 605: Lr7web Book 04a

Appendix: Scaling the Web C-3

C

must be purchased and installed on top of Windows NT 4.0 Servers.

Table B shows the number of Vusers that can run on a single server hosting differ-ent numbers of terminal sessions. Note that an extra terminal session is required (although not used) as an idiosyncrasy of LoadRunner ’s Agent communication protocol.

*Values are based on a 4-CPU 500 MHz Xeon Server running Windows 2000 Terminal Server

Although more Terminal Sessions should theoretically yield more Web Vuser hosting, Windows NT and Windows 2000 impose a Kernel-level limit of ~10,000 on the number of threads that each server can host. Thus each PC can host roughly 9,000 Web Vusers (since background processes and other tasks may con-sume the remaining thread resources).

Based on the nature of the scripts (e.g., downloading images concurrently, etc.), each Vuser consumes roughly 1-4 TCP/IP connection ports. Windows NT/2000 has a default of 5,000 transient ports that can be used for TCP/IP connection. Luckily, this default is configurable, and must be increased when attempting to run more than 3,000 virtual users. The following registry entries should be updated and the system rebooted to allow a large number of connections (and Vusers) on a single PC server.

KEY: HKLM\System\CurrentControlSet\Services\TcpIp\Parame-ters\MaxUserPort [This DWORD key may not exist in your system. In that case, you should create it.]

VALUE: 65534

KEY: HKLM\System\CurrentControlSet\Control\Session Man-ager\Sub Systems\Windows

VALUE: [Set second value to] 4096

Terminal Sessions 2 3 4 5 6 7

Web Vusers 1,500 3,000 4,500 6,000 7,500 9,000

Table B: Vusers on a single server* with multiple terminal sessions

Page 606: Lr7web Book 04a

C-4 LoadRunner for the Web 7.0

C

Finally, but most importantly, a network that is capable of supporting the traffic of thousands of users is essential in generating true load. Based on empirical data, each load driver station (PC) should have a dedicated 200 Mbps connection to the target server (via a bridge) when running thousands of Virtual Users. Collisions and network latency should be minimized in order to generate more load against the server. The following formula provides a good estimate of the number of requests that a fully utilized network can generate:

# of HTTP Requests per second (hps) = Bandwidth (bps) / ((Request + Response) * 8) (bph)

Example: A typical HTML page is 18 KB, thus Request + Response data size is roughly 18.5 KB. A 100 Mbps network can produce a maximum of ( 100,000,000 / 151,552 ) = ~660 HTTP requests per second (assuming an infinitely fast server and client). Realistically, only ~90% of this value is actually attainable (e.g., 600 hps). This figure is important in determining the maximum number of Vusers that are allowed to run on a given station without running into network band-width constraints.

Once a server is fully configured for the optimal number of Vusers, it can be mir-rored to launch an equivalent number of Virtual Users across multiple stations. Table C shows how many load drivers are needed to run a desired number of Vir-tual Users (assuming 7,500 Vusers per station).

# Web Vusers 1,000 5,000 10,000 20,000 50,000 100,000

# Windows 2000 4-CPU, 3GB RAM Servers

1 1 2 3 7 14

Table C: Number of servers required to run desired number of virtual users

Page 607: Lr7web Book 04a

Training Evaluation Form

1. How would you rate the quality of the instructor’s presentation? Please circle only one rating for each category:

Additional comments/suggestions about the instructor’s presentation skills.

_________________________________________________________________________________________________

_________________________________________________________________________________________________

_________________________________________________________________________________________________

2. How would you rate the quality of the course materials (slides and student workbook)? Please circle only one rating for each category.

Additional comments/suggestions about the course materials. Please list three specific suggestions.

1. _______________________________________________________________________________________________

2. _______________________________________________________________________________________________

3. _______________________________________________________________________________________________

(PLEASE TURN OVER)

COURSE: LoadRunner 7 for the Web NAME: ____________________________________

DATE:__________________________ COMPANY:_________________________________

INSTRUCTOR: ___________________ YOUR DEPARTMENT: ________________________

TELEPHONE #: ______________________________

Excellent Good Average Poor

Stated objectives clearly 8 7 6 5 4 3 2 1

Displayed knowledge of subject 8 7 6 5 4 3 2 1

Encouraged expression of opinions/ideas 8 7 6 5 4 3 2 1

Understood and responded to questions 8 7 6 5 4 3 2 1

Showed enthusiasm 8 7 6 5 4 3 2 1

Spoke understandably (clarity, volume, speed) 8 7 6 5 4 3 2 1

Excellent Good Average Poor

Overall effectiveness 8 7 6 5 4 3 2 1

Logical organization 8 7 6 5 4 3 2 1

Supported the course objectives 8 7 6 5 4 3 2 1

Comprehensive 8 7 6 5 4 3 2 1

Layout / visual clarity 8 7 6 5 4 3 2 1

Page 608: Lr7web Book 04a

3. Did you find any of the exercises or review questions difficult? If so, specify which topics could have been explained more clearly.

_________________________________________________________________________________________________

_________________________________________________________________________________________________

4. Is there any topic that you feel should have been presented in more depth? If so, please specify.

_________________________________________________________________________________________________

_________________________________________________________________________________________________

5. What were the most important skills, concepts, or ideas you learned in these courses?

1. ________________________________________________________________________________________________

2. ________________________________________________________________________________________________

3. ________________________________________________________________________________________________

6. Were your needs and objectives met? Why or why not?

_________________________________________________________________________________________________

_________________________________________________________________________________________________

7. Would you recommend our products to others? Why or why not?

_________________________________________________________________________________________________

_________________________________________________________________________________________________

8. Would you act as reference to other customers? Yes No (If not, please explain)

_________________________________________________________________________________________________

_________________________________________________________________________________________________

9. Are you interested in any other Mercury Interactive products? If so, which one(s)?

__________________________________________________________________________________________________

10. How would you rate the course administration? (for public classes only) Please circle only one rating for each category:

Additional comments/suggestions about the course administration:

_________________________________________________________________________________________________

_________________________________________________________________________________________________

Excellent Good Average Poor N/A

Registration procedures 8 7 6 5 4 3 2 1 __

Classroom 8 7 6 5 4 3 2 1 __

Course equipment (computers, projector, etc.) 8 7 6 5 4 3 2 1 __

Food 8 7 6 5 4 3 2 1 __

Page 609: Lr7web Book 04a
Page 610: Lr7web Book 04a

LR7WEB-04