Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Sampath Velupula
Sampath Velupula
Sampath Velupula
Sampath Velupula
Sampath Velupula
Sampath Velupula
Sampath Velupula
Components
Accurate scripts form the foundation of an effective load test. Once planning is completed the next step is to move to scripting. Scripting is done in VuGen.
Vusers emulate the actions of human users working with your application. While a workstation accommodates only a single human user, many Vusers can run concurrently on a single workstation.
Sampath Velupula
Supported Protocols
Sampath Velupula
10
What is a Scenario?
A scenario is a file that defines the scripts to execute, the number of Vusers to run, the goals of the test, the computer that will host the Vusers, and the conditions under which the load test runs. Using LoadRunner, you divide your application performance testing requirements into scenarios. A scenario defines the events that occur during each testing session.
Sampath Velupula
11
Sampath Velupula
12
Sampath Velupula
13
Sampath Velupula
14
Sampath Velupula
15
Quiz
What is LoadRunner? What are the versions of LoadRunner? What is VuGen? What is Controller? What is Analysis? What is a Load Generator? What is monitoring? What are performance objectives? What is planning in Load Testing?
Sampath Velupula
16
Planning
Sampath Velupula
17
Business Process
A business process is a set of actions or user steps performed within an application to accomplish a business goal. In the context of LoadRunner, it is a series of steps performed against the application under test. Just clicking a button is not a business process. It is only a step. A real business process consists of taking an actual action such as finding information, making a purchase, or changing an order. The individual tasks and functions performed by the users in the application are often called business processes. Heavy Throughput: Business processes that may not be mission-critical but are very popular.
Sampath Velupula
18
Business Process
Sampath Velupula
19
By estimating these navigation times, virtual users can be made to emulate their real world counterparts more accurately during a load test.
Sampath Velupula
20
What is a Concurrency?
A concurrency is a set of users acting upon an application in a similar manner at the same time. Concurrency occurs on three levels:
Application Level
How many users are active on the system? How many users are buying tickets? How many users are buying tickets now?
Sampath Velupula
21
Application Concurrency
Sampath Velupula
22
Sampath Velupula
23
Transactional Concurrency
How many transactions will need to be run per minute if a load test has to be run for two hours with 5000 users, assuming an average length of five minutes? Determine how many transactions run per minute:
120 minutes / 5 minutes = 24 iterations for each user. 5000 users X 24 iterations = 120,000 transactions. 120,000 transactions / 120 minutes = 1000 transactions per minute.
Apply the transactional concurrency to the application (refer to the Application concurrency figures):
The test is run during the 10-12 AM time slot. The test should consist of 5000 users running 24 iterations. The system must be able to handle 1000 transactions per minute.
Sampath Velupula
24
User Profile
Sampath Velupula
25
Peak Load
Sampath Velupula
26
Sampath Velupula
27
Sampath Velupula
28
Components
Sampath Velupula
29
Sampath Velupula
30
WAN Emulation
Sampath Velupula
31
WAN Emulation
WAN emulation software mimics the WAN/Internet by slowing, dropping, and changing packets between client and server. Should be installed on all load generator machines (requires a separate install and license). Discover how certain elements affect the performance of your site when remote users connect.
Network latency Packet loss Packet duplication Packet fragmentation Bit error rates
Sampath Velupula
32
Quiz
Please give me the file extensions for each component in LoadRunner. Please tell me what is WAN Emulation.
Sampath Velupula
33
Vuser Generator
Sampath Velupula
34
Testing Process
Planning the Test
Sampath Velupula
35
Script Development
Record a basic Vuser script
Sampath Velupula
36
Protocols
Sampath Velupula
37
Sampath Velupula
38
What is a Script?
A Script emulates the steps of real users using the application. A VuGen script, also known as a Virtual User (vuser) or Transaction File, is the recorded user actions captured by Virtual User Generator. When played back, the file interacts with an application just like a real user. In a load test, data from this interaction is reported back to LoadRunner Analysis allowing for systematic diagnosis of the root cause problem. The script file itself is a ANSI-C script file that supports all programming conventions available to the C programming language, as well as functions specific to VuGen scripts.
Sampath Velupula
39
Recording
Monitor communication between client and server
Browser (Client)
Server
Generate required function calls Insert generated function calls into Vuser script.
Sampath Velupula
40
Recording
Sampath Velupula
41
Recording Options
Use a threshold value for think time. If the recorded think time is less than the threshold. Selecting a recording level in VuGen lets you specify the information to be recorded and which functions to use when generating the script.
HTML-based script URL-based script.
For LoadRunner scripts, HTML level is a common choice. On very complex web applications, the entire script may need to be recorded at URL level.
Sampath Velupula
42
Recording Options
Setting the Recording Level:
Sampath Velupula
43
Recording Options
HTML is a higher level that records in "Browser" or "Context Sensitive" mode. This setting allows the Browser to determine which page resources (such as images or Flash content) should be downloaded depending on the HTML source that was downloaded during replay. HTML level will generate a web_submit_form statement URL is a lower level that records in "Analog" mode. This setting does not allow the browser to determine which page resources (such as images or flash) should be downloaded. Each resource is recorded in the script during the Recording session. This level will also record any hidden items, such as session information, sent to and from the server. URL Level will generate a web_submit_data statement
Sampath Velupula
44
Recording
Sampath Velupula
45
Vuser.usr
Sampath Velupula
46
default.cfg
Sampath Velupula
47
Script Details
Sampath Velupula
48
Exercise
Start Recording Stop Recording Recording Summary Work with Thumbnails View the Script in Tree view Understand snapshots Rename steps Return to workflow wizard Save script
Sampath Velupula
49
Recording Summary
Once the recording is completed, the workflow moves to the Recording Summary step. Thumbnails display the snapshot in HTML as they would appear in a browser, making it easier to select the correct step. Now the script is ready for further enhancement and editing. You can do so in
Workflow Wizard view Task View TREE VIEW SCRIPT VIEW.
Sampath Velupula
50
Tree View
URL: A URL icon is added to the script when you type in a URL or use a bookmark to access a specific web page. Link: A link icon is added to the script when you click a hypertext link while recording. Each link icon represents a web_link function in the script. Image: An image icon is added to the script when you click a hyperlink attached to an image while recording. Each image icon represents a web_image function in the script. Form/Data Submission: A Submit Form or Submit Data icon is added to the script when you submit a form while recording.
Sampath Velupula
51
Recording Snapshots
Page View: Displays the snapshot in HTML as it would appear in a browser. This button is available for both the Recording and Replay snapshots. Use this view to make sure you are viewing the correct snapshot. Server Response: Displays the server response HTML code of the snapshot. This button is available for both recorded and replayed snapshots. The HTML view also shows a tree hierarchy of the script in the left pane, with a breakdown of the document's components: Header and Body with the title, links, forms, etc. Client Request: Displays the client request HTML code of the snapshot. This button is available for both the recorded and replayed snapshots. The HTML view also shows a tree hierarchy of the script in the left pane, with a breakdown of the document's components: Header and Body and their subcomponents.
Sampath Velupula 52
Run-time Settings
Run-time settings define the way in which a script runs.
Stored in the default.cfg in the Vuser script directory. Applied to Vusers when the script is executed using VuGen or the Controller.
Configuring run-time settings enable you to emulate different kinds of user activity.
Sampath Velupula
53
Replay
After recording, always play back the script to verify that the script is running as intended. The goal is to perform a "sanity check" before the script is assigned in the Controller. Test the script with just one iteration to verify basic functionality. Configure RUN-TIME SETTINGS to test specific aspects of the script. It is strongly recommended that you re-run the script after any modifications or enhancement to verify the integrity of the script. Click the START REPLAY button to play back the script.
Sampath Velupula
54
Run-time Settings
Run Logic defines how to set iterations Log: During playback, scripts log information about themselves and their communication with the server.
These messages can be captured in the REPLAY LOG by checking (enabling) the Extended Log before playing back the script.
Proxy: A proxy server acts as an intermediary between a workstation and the Internet so that the enterprise can ensure security, administrative control and caching.
Sampath Velupula
55
Run-time Settings
Sampath Velupula
56
Run-time Settings
Sampath Velupula
57
General Settings
Animated run delay: Allows you to toggle between running a script in animated and non-animated modes.
When you run in animated mode, VuGen highlights the line of the script being executed at the current time.
Prompt for results directory: Prompts you for a results directory before running a script from VuGen. After replay show: Instructs VuGen how to proceed after the replay. Auto show function syntax: When you type the opening parenthesis of a function Auto complete word: When you type the first underscore of a function Display Tab: allows you to specify whether VuGen displays the run-time viewer
Sampath Velupula
58
REPLAY LOG
When script execution is complete, you examine the messages in the REPLAY LOG to see whether your script ran without errors. Various colors of text are used in the Replay Log:
Black: Standard output messages Red: Standard error messages Green: Literal strings that appear between quotation marks (e.g. URLs) Blue: Transaction Information (starting. ending. status and duration) Orange: The beginning and ending of iterations.
Sampath Velupula
59
Debugging Tools
Run-Time Viewer: The run-time viewer shows each web page as it is accessed by the script This is useful for debugging, as it allows you to check whether a script has accessed the correct web page or not. Replay Summary: When the script execution is complete, displays the summary of the script status. Test Results window: Summarizes the success or failure of each step of the playback web script Replay Log: When the script execution is complete, communications between the script and the server are listed in the REPLAY LOG. Snapshot Results window
Page View Server Response Client Request
Sampath Velupula
60
Example Script
Sampath Velupula
61
Transactions
Transactions are defined to measure the performance of the server. Each transaction measures the time it takes for the server to respond to specified Vuser requests. The Controller measures the time taken to perform each transaction during the execution of a performance test.
Sampath Velupula
62
Transactions
LoadRunner's means of measuring elapsed response time of one or more user steps Implemented by adding Start Transaction and End Transaction steps May overlap and may be nested May be added during or after recording Lr_start_transaction, lr_end_transaction Always use name as AppName_TransactionNumber_Process Automatic Transaction in Run-time settings Transactions help:
To measure mission-critical, heavy throughput and dynamic content business processes. In determining the nature of Application problems. In estimating which business process is failing by tracing the failed transactions With reporting the failed business process to Analysis graphs.
Sampath Velupula
63
Exercise
New Transaction Transaction Editor Transactions during recording
Sampath Velupula
64
Parameterization
Parameterizing the scripts eliminates problems that can cause errors in your testing or produce misleading load test results. When a script contains parameterized data, virtual users can make varied selections. This makes a test much more true to life, and therefore much more likely to create realistic results.
Sampath Velupula
65
When to Parameterize
Unique Constraint
While a virtual user is logged in with the 'jojo' username, any other user who tries to log in with the same username will get an error
Date Constraint
A date recorded into a script yesterday may be invalid today.
Data Dependency
Whenever the parameterized value for an object on the application determines what values are valid for another object on the application
Data Caching
Data caching problems will not cause your script to fail, but they may cause load test result to be misleading.
Sampath Velupula
66
Exercise
Parameterize Input Data Steps
Sampath Velupula
67
Parameter Types
Internal Data
Date/Time Random Number Unique Number Iteration Number Load Generator Name Vuser ID
Sampath Velupula
68
Sampath Velupula
69
Sampath Velupula
70
Auto Correlation
Replay of Script Indicates Error Dynamic Value Recorded:
HTML pages often contain dynamic data, which is data that changes each time you access a site. Login string, Date/Time Stamp, Common Prefix
Sampath Velupula
71
Auto Correlation
Correlate the Script: VuGen correlation is the process of enhancing the VuGen script to process the dynamic data passed between the client (browser, or VuGen) and server, just like a live browser. Automatic correlation can be done during or after recording To work correctly, automatic correlation requires at least one playback. Correlation after recording uses a built-in comparison utility. Allows you to view the text or binary differences between the recording and playback snapshots VuGen inserts a web_reg_save_param function and a comment into your script indicating that a correlation was done for the parameter. Manually insert correlation functions
Sampath Velupula
72
Manual Correlation
Find the differences using Wdiff Locate the string and its details Identify Patterns using Boundaries Identify the string that is immediately to the left of the dynamic data. Identify the string that is immediately to the right of the dynamic data. web_reg_save_param_ex Identify Patterns using Xpaths web_reg_save_param_xpath
web_set_max_html_param_len("512"); web_reg_save_param("serverHost", "NOTFOUND=ERROR", "LB=<PARAM name=\"serverHost\" value=\"","RB=\">", LAST); web_reg_save_param("serverArgs", "NOTFOUND=ERROR", "LB=<PARAM name=\"serverArgs\" value=\"","RB=\">", LAST);
Sampath Velupula
73
Auto Correlation
Steps: Set General Options and play back the script. Review the Replay Summary. If dynamic values were detected, scan for dynamic values. Analyze the correlation results. Correlate the dynamic value by pressing the Correlate button. Verify correct execution.
Sampath Velupula
74
Verifications
A load test is always performed after functional testing. Attention should be paid to the functionality of the application while it is load tested to ensure that what worked correctly under low load still works correctly under heavier load. VuGen allows you to add Checkpoints for verification automatically and also programmatically. A text check is a search for a specified text string on a web page.
Adds web_reg_find registration function to the script. Registration means that it does not execute the search immediately, but performs the check while the page is being downloaded.
Once the Checkpoint is added, replay the script. To make sure that the text check passed view the Replay Log by clicking on the REPLAY LOG link in the Last Replay Summary View the success of the Checkpoint in the TEST RESULTS by clicking on the VIEW VISUAL TEST RESULTS link
Sampath Velupula
75
Actions
Action: In VuGen is a set of recorded user steps in a script that allow you to emulate a particular user task through script iteration. VuGen allows you to emulate user activities by grouping tasks sections called Actions There are three default Actions that a new script contains: vuser_init, Action and vuser_end. Example:
Log in recorded in Vuser_init Create New Order in Action Logout in Vuser_end
Sampath Velupula
76
Sampath Velupula
77
Sampath Velupula
78
Action Blocks
Action blocks are groups of actions within your script. When running scripts with multiple actions, blocks help you with grouping allowing you to iterate some actions more frequently than others. Open the RUN-TIME SETTING. Select the GENERAL: RUN LOGIC node. Add a new action block. Click INSERT BLOCK. VuGen inserts a new Action block at the insertion point with the next available index (BlockO. Block I, Block2). Add the desired actions to the block by Clicking INSERT ACTION and then by selecting the actions from the Actions list.
Sampath Velupula
79
Sampath Velupula
80
Sampath Velupula
81
Rendezvous points
Rendezvous points are used to synchronize Vusers to perform a task at exactly the same moment to emulate heavy user load. When a Vuser arrives at a rendezvous point, it is held by the Controller until all Vusers participating in the rendezvous reach that point. You may only add rendezvous points in the Action section not to the init or end
Sampath Velupula
82
Rendezvous points
Sampath Velupula
83
Configuration Files
vuser_init.c Action.c vuser_end.c <protocol ID>.usr globals.h default.usp default.cfg
The C files are the initial script actions files added to a new script. default.usp is the default run logic. globals.h contains the include statement for this protocol's header and sometimes other declarations. The run-time settings configuration file, default.cfg, contains the default run-time settings. The <Protocol ID>.usr file contains the initial configuration for a new script.
Sampath Velupula
84
Template Files
The <LoadRunner installation>\merc_asl\< protocol id>.asl file lists the API functions of the protocol File <LoadRunner installation>\dat\mdrv\mdrv_<protocol id>.dat is the configuration file of the mdrv process. The <LoadRunner installation>\dat\<protocol name>_steps.dat file configures presentation of steps in the Insert Step dialog and elsewhere in the VuGen user interface. The <LoadRunner installation>\bin\vslick\builtins\<Protocol ID>RuntimesCpp.h file contains the formats of the API functions as they are displayed by IntelliSense, with a few comment lines for each function. The <LoadRunner installation>\bin\vslick\<Protocol ID>.vlx file contains the API function names and keywords. The file <LoadRunner installation>\dat\protocols\<protocol id>.lrp is the master configuration file for the protocol.
Sampath Velupula
85
Controller
Sampath Velupula
86
What is a Scenario
Sampath Velupula
87
Sampath Velupula
88
Sampath Velupula
89
Sampath Velupula
90
Sampath Velupula
91
Vuser Groups
Sampath Velupula
92
Sampath Velupula
93
Sampath Velupula
94
Goal-Oriented Scenario
Goal may be throughput, response time or number of concurrent Vusers. LoadRunner manages Vusers automatically. Cannot add, start, or stop Vusers interactively during a scenario run.
Sampath Velupula
95
Sampath Velupula
96
Load Generators
Sampath Velupula
97
Sampath Velupula
98
Sampath Velupula
99
Pacing
Controls the delay between iterations
Log Settings
Different types of information are logged depending on the options selected.
Think Time
LoadRunner Think Time is a measurement of the time that a real user takes to pause between the execution of steps in a business process
Additional Attributes
Additional attributes allows you to pass parameters to prepared scripts, enabling the testing and monitoring of servers with different client parameters.
Miscellaneous Settings
Sampath Velupula
100
Browser Emulation
Emulates different browsers to test user experience on response times and content availability.
Proxy
Configures Vusers to obtain proxy settings either from the default browser or to bypass proxy and make direct connections to the Internet.
Preferences
Generates analysis graphs by selecting options under Generate Web Performance Graphs.
Sampath Velupula
101
Running Scenarios
Load Generators at run time:
Results are stored locally on each load generator. After execution, results from all load generators are transferred to the Controllers results directory for analysis.
Sampath Velupula
102
Rendezvous Point
An intersection point in a business process A Rendezvous is a step added during script creation and defined in VuGen. To use a Rendezvous, it must be configured in the Controller. When a Rendezvous is present in a script, transaction times become meaningless. A Rendezvous policy may be defined in three ways
Percentage of all users (What if everybody tried to log in now?) Percentage of all running Vusers (50% of users arrive between 8AMand 9AM) Number of users (What if 10 clients try to log in now?)
Sampath Velupula
103
Sampath Velupula
104
Sampath Velupula
105
Scenario Executions
Debug Run
Shows the responsiveness of the site under low stress.
Full Load
The entire expected load is applied using a slow ramp up.
Scalability Test
Determine whether your system is scalable for increased load.
Sampath Velupula
106
Sampath Velupula
107
Sampath Velupula
108
Sampath Velupula
109
Sampath Velupula
110
Sampath Velupula
111
Scheduling Scenarios
Enables the repetition of important usage patterns throughout load testing for the defined duration of the load test.
Sampath Velupula
112
Sampath Velupula
113
Sampath Velupula
114
Sampath Velupula
115
Sampath Velupula
116
Configure Monitors
Sampath Velupula
117
Monitor Measurements
Sampath Velupula
118
Analysis
Sampath Velupula
119
Sampath Velupula
120
Sampath Velupula
121
Sampath Velupula
122
Sampath Velupula
123
Sampath Velupula
124
Sampath Velupula
125
Sampath Velupula
126
Sampath Velupula
127
Sampath Velupula
128
Auto Correlation
Auto Correlation
Allows automatic selection of graphs to correlate in order to find the metrics that most influence the transaction response time Automatically correlates the transaction graph with all performance metrics and displays the ones that show the highest match in their behavior; this allows you to disregard irrelevant metrics Visually displays correlated metrics closely correlated to the transaction response time, which speeds identification of the likely causes of performance bottlenecks
Auto Correlation lets you correlate a measurement in a graph with other monitor measurements during a specific time range of the scenario. This enables you to view similar measurement trends.
Sampath Velupula
129
Sampath Velupula
130
Quiz
Sampath Velupula
131
Report Metrics
Load size: The number of concurrent Virtual Clients trying to access the site. Throughput: The average number of bytes per second transmitted from the ABT (Application being tested) to the Virtual Clients running this Agenda during the last reporting interval Round Time: It is the average time it took the virtual clients to finish one complete iteration of the agenda during the last reporting interval. Transaction Time: The time it takes to complete a successful request, in seconds. (For a web-based application, each request for each gif, jpeg, html file, etc. is a single transaction.) The time of a transaction is the sum of the Connect Time, Send Time, Response Time, and Process Time Connect Time: The Time it takes for a Virtual client to connect to the Application Being Tested.
Sampath Velupula 132
Report Metrics
Send Time: The time it takes the Virtual Clients to write a request to the ABT (Application being tested), in seconds. Response Time: The time it takes the ABT(Application being tested) to send the object of a request back to a Virtual Client, in seconds. In other words, the time from the end of the request until the Virtual Client has received the complete item it requested. Process Time: The time it takes to parse a response from the ABT (Application being tested) and then populate the document-object model (the DOM), in seconds. Wait Time (Average Latency): The time it takes from when a request is sent until the first byte is received. Receive Time: The elapsed time between receiving the first byte and the last byte.
Sampath Velupula 133
Functions
Sampath Velupula
134
Common Functions
Message functions
lr_error_message and lr_output_message Send messages to the output, indicating an error or a warning.
Transaction Functions
lr_start_transaction and lr_end_transaction Add transactions and synchronization points to a script. For example, the lr_start_transaction function marks the beginning of a transaction, and the lr end transaction function marks the end of a transaction.
Run-Time Functions
lr_think_time and lr_exit
Parameter Functions
lr_save_date time, lr_advance param, lr eval string, lr_save string and lr get attrib_string
Sampath Velupula
135
Common Functions
Ir_abort
Aborts the execution of a script. It stops the execution of the Actions section, executes the vuser_end section, and ends the execution:
Ir exit
lr exit (int continuation_option, int exit status); lr_exit(LR_EXIT VUSER, LR_FAIL); Exits from the script, action, or iteration:
Ir_save_string
Assigns the specified null-tenninated string to a parameter: lr_save_string(canst char *param_value, canst char *param_name); This function is useful in correlating queries. lr_save_string(777, emp_id);
Sampath Velupula
136
Common Functions
Ir_save_date_time
Saves the date and time into a parameter: lr save_date_time(const char *format, int offset, canst char *name};
Ir_advance_param
Advances to the next available value in the parameter data file: lr_advance_param (const char * param);
Ir_eval_string
Returns the value of the parameter as a string. lr eval string("(parameter name)");
Ir_get_attrib_string
Assigns the specified null-tem1inated string to a parameter lr_get_attrib string (canst char * argument); lr_save_string(lr_get_attrib_string("URL"),"TescURL";
Sampath Velupula
137
Common Functions
Web_reg_save_param
Saves dynamic data information to a parameter: web_reg_save_param(const char *ParamName,LB,RB,ORD,SaveLen,SaveOffset, LAST); web_reg_save_param("tlight_name","LB=Select your departure",rtRB="U,LAST);
Web_reg_find
Registers a search for a text string for the next Action function: Web_reg find("Text=Welcome", SaveCount, LAST); web reg_find ("SaveCount=booked_count", "Text=our \n""itinerary has been booked", LAST);
Sampath Velupula
138
SAMPATH VELUPULA
139
SAMPATH VELUPULA
140
String
SAMPATH VELUPULA
141
Transactions
SAMPATH VELUPULA
142
SAMPATH VELUPULA
143
SAMPATH VELUPULA
144
SAMPATH VELUPULA
145
Web Misc
SAMPATH VELUPULA
146
SAMPATH VELUPULA
147
SAMPATH VELUPULA
148
SAMPATH VELUPULA
149
ANSI C in VuGen
Variable
A variable is a named entity which may represent different values at different times.
Constant
A constant is a named entity which always represents the same value. lr save datetime("Tomorrow is %B %d %Y", DATE NOW + ONE DAY, "next ") ; Another example: if (event == GENERAL ERROR) lr set transaction status(LR FAIL); lr end transaction("tl", LR AUTO);
Sampath Velupula
150
Branching Statement
Sampath Velupula
151
Loop Statement
Sampath Velupula
152
C Language Functions
SAMPATH VELUPULA
153
C Language Functions
SAMPATH VELUPULA
154
C Language Functions
SAMPATH VELUPULA
155
Quiz
SAMPATH VELUPULA
156
THANK YOU
SAMPATH VELUPULA