[go: up one dir, main page]

0% found this document useful (0 votes)
116 views185 pages

Load Runner Materials

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views185 pages

Load Runner Materials

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 185

Load Runner

Material
Contents
1. Introduction ....................................................................................................................................... 3
2. Load Runner Components ................................................................................................................ 4
3. Load Runner Architecture: ............................................................................................................... 4
4. Performance Test Life Cycle ............................................................................................................. 5
1. Proof of Concept (POC)................................................................................................................. 5
2. NFR – Non Functional Requirements ........................................................................................... 6
3. Test Plan......................................................................................................................................... 7
4. Work Load Model.......................................................................................................................... 8
5. Recording and Enhancements ....................................................................................................... 8
Correlation: .................................................................................................................................. 10
Parameterization: ........................................................................................................................ 16
Verification points/checkpoints: .................................................................................................. 22
Advanced Techniques .................................................................................................................. 23
C Data Types ................................................................................................................................ 23
File operations: ............................................................................................................................ 27
Pre-defined functions ................................................................................................................... 29
LR Functions: .............................................................................................................................. 29
Web Functions: ............................................................................................................................ 34
Recording Options ....................................................................................................................... 44
6. Test Data ...................................................................................................................................... 46
Regular Expressions ............................................................................................................................ 48
Fiddler: ................................................................................................................................................ 49
CONTROLLER .................................................................................................................................. 50
IP Spoofing ................................................................................................................................... 52
Runtime settings........................................................................................................................... 54
Pacing Calculations ...................................................................................................................... 59
Performance Center ............................................................................................................................ 67
ALM (Application Life Cycle Management) ...................................................................................... 69
Types of testing .................................................................................................................................... 70
ANALYZER ........................................................................................................................................ 73
Thread Dump ...................................................................................................................................... 80

Memory Dump: ................................................................................................................................... 81


Difference between Load Runner versions: ........................................................................................ 82
Profiling Tools ..................................................................................................................................... 83
Page 1
1. JConsole ................................................................................................................................... 83
2. JVisualVM: .............................................................................................................................. 84
3. JMC(Java Mission Control) .................................................................................................... 85
Monitoring Tools ................................................................................................................................. 87
1. Site scope: ..................................................................................................................................... 87
2. Dynatrace ..................................................................................................................................... 88
3. HP Shunra.................................................................................................................................. 100
4. Perfmon ...................................................................................................................................... 101
CVS/VSS (Concurrent Versioning System/Visual Source Safe) ...................................................... 101
Bottlenecks ......................................................................................................................................... 102
COUNTERS ...................................................................................................................................... 110
Protocols ............................................................................................................................................ 113
1. SAP Web Protocol ..................................................................................................................... 113
2. SAP GUI Protocol ...................................................................................................................... 116
3. Web Services Protocol ............................................................................................................... 118
4. Web click & Script Protocol ...................................................................................................... 123
5. RTE (Remote Terminal Emulator) Protocol ............................................................................ 125
6. Citrix ICA Protocol.................................................................................................................... 127
7. Oracle NCA Protocol ................................................................................................................ 129
8. The Ajax TruClient User Interface .......................................................................................... 129
AWR REPORTS ............................................................................................................................... 145

Page 2
LOAD RUNNER:
1. Introduction:
One of the best automated performance tool. It uses ANSI C as the default programming
language and other languages like JAVA & VB.
Advantages:
 It supports all types of protocols (HTTP, FTP and SMTP).
 Easy to analyze the results and generating scripts.
Load Runner was invented by Mercury, and acquired by Hewlett – Packard Organization.

Performance Testing:
Performance Testing is a Non-Functional testing performed to evaluate application
performance under some load and stress condition. It is generally measures in terms of speed,
scalability & stability for the user activity.
Speed: Determines whether the application responds quickly.
Scalability: Determines maximum load the software application can handle.
Stability: Determines if the application is stable under varying loads.
There are different types of performance testing. They are
 Load Testing
 Stress Testing
 Endurance Testing
 Scalability Testing

Why Performance testing required for any application?


We should verify “the application behaving under load” and to avoid the business loss.

Q. Can’t we conduct the performance testing without tool?


Sol: We can conduct the performance testing without a tool. In realistic environment application
accessed by 10,000 people, to simulate the realistic environment we have to require 10,000
people, which is not possible to require these many resources.
Below are the constraints stopping us to conduct the PT without tool.
 Accuracy
 Time
 Budget
 Resources
To over come the above issue. We have to use tools instead of manual resources.

Page 3
Q. What are the tools available in market?
Sol:
Load Runner - HP
RPT [Rational Perform Testing] - IBM
J Meter - Open Source
Neo Load - Neotys
Open STA - Open Source
Oats - Oracle
VSTS - Micro Soft
SPT - Borland
SOASTA - Open Source
Web Load - Open Source

2. Load Runner Components:


1. VUGen – Virtual User Generator
It will allow you to record and replay script. And allow you to enhance your script.
2. Controller
It will allow you to design the scenarios and execute the test with multiple users.
3. Analyzer
It will allow to analyze the statistics and finding out the bottlenecks
4. Load Generator
It generates the load against the application.
5. Agent Process
It will establish the connection between Load Generator & Controller.

3. Load Runner Architecture:

VUGen Web Server


AP
L
G
Controll
Applicatio
er AP n Server
L
G
Analyzer AP Database Server
L
G

Response Time
Response Time: The roundtrip of request is called Response Time.

Page 4
Q. Load Runner License
 VUGen, Load Generator, Agent Process, Analyzer are available at free of cost.
 We have to buy control license using controller you can conduct only one test at any
point of time.
 You have to buy Vuser License.
 You have to buy protocol bundle license.
Note:
 While procuring HP load runner license you receive SAID (Software Agreement
Identification Number).
 Using SAID we can raise the tickets or requests in HP site to get the assistance from HP
to resolve the issues.

4. Performance Test Life Cycle:


Q. Performance Test Life Cycle (or)
Roles and Responsibilities in current Project (or)
Process usually you will follow in Performance Testing Project
Sol:
1. POC - Proof of Concept Doc
2. NFR - Non Functional Requirements Gathering Mode
3. Test Plan l
4. Work Load Model / Load Model / Volume Model / Volume Matrix
5. Scripting & Enhancements
6. Test Data
7. Scenario Design & Execution
8. Analysis
9. Reporting & Recommendation.

1. Proof of Concept (POC):


Sol: As part of POC, I will try to understand the application architecture, what kind of
application is this? Which technology they used to develop this application. Which
communication mechanism they used to develop this application and complexity of the
application.
I will try to identify which tool is compatible for this application, if it is load runner which
protocol is compatible for this application, whether it is a single/multiple protocols.
As part of POC, I am going to record simple business scenarios, execute with minimal users &
report the response times to the client.
Based on the above POC, Client has to understand which tool he supposed to buy, which
protocol bundle he supposed to buy & how many labor hours required to finish this application.

Page 5
2. NFR – Non Functional Requirements
Sol: We have to prepare NFR document with a help of BA (Business Analyst) people or project
team people.
NFR contains CBT’s (Critical Business Transactions),peak hours, half peak hours(low
load),expected average response times, no. of transactions per hour & hardware threshold
statistics like CPU, Memory, Heap, Swapping.
We have to gather and what kind of tests we supposed to perform in terms of availability,
serviceability, scalability, recoverability, baseline, benchmark, failover, abnormality & spike.
After prepare NFR document, we have to get it approved by project team, architects,
infrastructure team, NW team and stakeholders.

What is your approach to gather NFR, if client doesn’t know anything about performance
testing?
Scenario-1:
If Application is already in production
Sol: Get the production log files for 1 year historical data using Site analytical tools (or) splunk
tool & try to identify top 5 usage days from that how many no. of visitors accessing that
application, how many no. of page views are happening, which JSP/ASP pages are mostly
accessed by end users & from which region they are accessing the application.
Based on the visitors you can identify no. of users, based on the page views you can
identify no. of transactions.
Based on the JSP/ASP pages you can identify the CBT’s, based on the IP address we can
identify the location/region &conduct baseline testing to identify the expected response time (or)
to baseline the application.
Note:
Whenever we don’t have (SLA’s: Service Level Agreement) expected response times, we
have to conduct baseline test.

Scenario-2:
Client doesn’t know anything & application not in production.
Solution: Get the competitor statistics and conduct the PT
Sol: Using N/W traffic utilities (Ex: www.alexa.com) get the competitor statistics & identify
NFR’s in terms of peak hours, half peak hours, no. of users, no. of page views from which
location they are accessing the application, which pages mostly access by end users & what are
the expected response times for every page.

Page 6
Scenario-3:
Client doesn’t know about performance testing & application not in production & we don’t
know have a competitor in market.
Sol: Try to understand the Core Business of the application and convert core business to Online
Business. By converting identify how many no. of users, no. of transactions, CBT’s, from which
region they are accessing the application and conduct the base line test to derive SLA’s.
Below are the questions we asked to BA (Business Analyst):

Q-1: How many no. of customers do have in core business?


Sol: 1.3m customers.
Q-2: How many of them are going to register for online services?
Sol: 10%
Q-3: How many of them are active users?
Sol: 10%
Q-4: How many of them are daily users?
Sol: 30%
Q-5: What are the peak hours for our business?
Sol: 4 hours
Based on above statistics we derived the number of users and number of transactions.

Generic Case Study:


I have an application stake holders & project is not in a situation to provide the requirement. So
we approached Business Analyst (BA) People to finalize the NFR.

3. Test Plan
Sol: Test Plan is a road map of our test,
Test Plan contains objective of the test, scope, items out of scope, procedure, approach,
test data, CBT’s, types of testing, monitoring, application architecture, tool architecture,
deliverables, roles & responsibilities, environment, risks & migrations, entry criteria, exit
criteria, prerequisites & assumption.

Entry Criteria:
Whenever the Pre-requisites are satisfied that is called Entry Criteria.

Exit Criteria:
Whenever derived statistics are meeting expected statistics that can be considered as Exit
Criteria.

Note: Test strategy will describe approach & procedure of the test.

Page 7
4. Work Load Model
Sol: Work Load Model is a heart of all the documents which will be lead you
“How to test that application?”
&
“What to test that application?”

Work Load Model contains CBT’s, business flows for every CBT’s, no. of transactions,
types of testing, load distribution based on types of testing.
While preparing Work Load Model we have to consider Pacing & Think time calculation
to generate ‘Anticipated Load’.
Work load model will assist you to design the scenario.
Input: Use cases, types of testing, number of users
Output: Pacing, think time and transaction mix

5. Recording and Enhancements


Protocol: Protocol is a set of rules.
Request
User Server
Response

Protocol Adviser:
This option is available from 9.5 version & allows you to choose appropriate protocol for an
application.
Note:
Protocol Adviser never helps you to choose the appropriate protocol in realistic environment. We
have to understand the communication mechanism & architecture; we used to contact AD people
to understand which communication mechanism they used in application development. Based on
all these we used to finalize the protocol for an application.

Famous Protocols in current market:

Citrix ICA: When ever application published in Citrix environment we have to Citrix ICA
protocol.

Flex: Flex (Rich internet applications) is a product of Adobe. If the application front end is
developed in flex then use Flex protocol.

Ajax TruClient: If you would like to measure the response times which includes server side and
browser response times (Java script execution).

Page 8
RTE (Remote Terminal Emulator): If the application is developed in Unix Environment. We
have to use RTE Protocol.
Ex: Cursor based application, Mainframe application.

SAP Family: if the application developed in ECC and netviewer and dynapro portal we can use
these protocols.

Web (HTTP/HTML):It is famous among all the protocols. If the application uses http protocol
then use this protocol.

Web Services: It is also one of the famous protocols. If the application uses API’s or web
services or xmls or jsons or restful xmls then we have to use this protocol.

Web (Click and script): It will record browser specific requests


Note:
 Start HP Web Tours Server.
Then only we access the application. (its specific to web tours application)
 Web Browser
Invoking application through web browser.
 VUGen
It invokes the actions & then converts to the script code.

Page 9
Correlation:
Correlation is the concept to handle the dynamic values which are generating from server side.
(Or)
Dynamic input to the server. You can conduct the correlation in 2 ways:
1. Auto Correlation.
2. Manual Correlation.
1. Auto Correlation:
Automatically handle the dynamic values.
Process:
 Auto correlation process after 11.5 version
1) Record the script.
2) Replay the script (It’s not mandatory from LR 11.5 version).
3) Click the design studio.
4) Choose the dynamic value.
5) Click on “Correlate button”.
From the above steps, this will create a function & automatically substitute the dynamic value.

 Auto correlation process before 11.5 versions.


1) Record the script.
2) Replay the script at least once.
3) Click on “Correlate button”.
4) Choose the dynamic value from correlate log.
5) Click on “Correlate button”.
Note:
A design studio or correlation log compares record time response with replay time response
dump the differences into the correlation log or design studio.

2. Manual Correlation
Manually we have to handle the dynamic values. Whatever the steps performed by
autocorrelations steps will be performed manually.
Process:
Step1: How to identify the dynamic values in a script?
Sol: Record the same business scenario twice with 2 sets of data & compare both of them
using “beyond-compare” or “www.text-compare.com” or Tools“Windiff” (default).
Which values reported differently those values will be considered as dynamic values.
Note:
Which values are not entering through keyboard & which values are chosen from the application,
those values will be considered as dynamic values.

Page 10
Step2: How to identify the left text & right text for a dynamic value?
Sol: web_reg_save_param(“parameter_name”,”lb=”,”rb=”,LAST);
 Copy the dynamic value.
 Go to generation log identify first occurrence of the dynamic value.
 Copy the left text & right text of the dynamic value.

Step3: Where to write the function?


web_reg_save_param(“parameter_name”,”lb=userSession” value=” ”,”rb=”/>”,LAST);
Sol1: Execute the script in full mode (F4LOGExtended LogEnable All Options). Identify
the dynamic value based on the left boundary or right boundary in Replay log. Double click on
the same line which will assist you to where to write the function or for which request the
dynamic value was generated.
Sol2: (Not recommendable for web tours) once you identified the dynamic value in generation
log place the cursor on the same line and search for “web_” or “ENDED” then copy the request
and search for the same in script. On top of the same request u can place the function.
NOTE: Generation log contains response and request which never change.
Step4: Substitution
Sol: You can substitute the parameter name where ever the dynamic value is present in script
using control+H.

Correlation Function with all Arguments


1. ORD:
ORD stands for “Occurrence”.
By default ORD=1.
Ex:
Ord=10 stands for 10thoccurrence.
Ord=ALL stands for captures all values based on LB & RB.
Whenever you written ORD=ALL your parameter become an Array. It holds all
the values with the name of parameter-1, parameter-2 & parameter-N.
Note:
Variable_count let we know the length of an Array.

2. Save Length:
Allow you to capture specific no. of characters from dynamic value based on LB and RB.
Ex: savelen=3
By default savelen=”-1”.

3. Save offset:
It will specify the no. of characters it supposed to skip from the dynamic value.
By default saveoffset=”0”.
EX: saveoffset=3 (It skips 3 char)

Page 11
4. Not found:
By default notfound=”error”.
If the either LB or RB is not present in the response script will through the error like “No
match found for the requested parameter”.
notfound=”warning”.
If you would like to continue the script execution, even LB or RB is not available in the
response you have to use warning.

5. Search:
It is an optimization technique. This will instruct the user to search for LB & RB in a
specific location.
By default search=ALL.
Ex: Search= headers: - it will search for LB n RB in only on header
Ex: Search= Body: - it will search for LB n RB in only on body

6. RelframeID:
This is also optimization technique. Specifying to capture the dynamic value from a
specific frame.
Ex: RelframeID=1.2.1

HTTP Status Codes:


100 - Request successfully delivered.
200 - Response received successfully.
300 - Received response but it was redirected response.
400 - Invalid request.
500 - Application itself not available.

7. Ignore Redirection:
By default ignore redirection= YES
Instructing correlation function to capture dynamic value from a redirected response or not.

8. Convert:
Send Request

Get Response

Again Send Request

HTML - Hyper Text Markup Language


XML - Extensible Markup Language

Page 12
Ex: HTML to URL
When ever the dynamic value is recorded in the format of URL and the captured value in
the format of HTML. Use convert argument to convert HTML to URL but did not “Vice-Versa”.

Ex: Convert= HTML_TO_URL

Interview questions

Q1. Why correlation required?


Sol: Whenever you record a use case request make contains some dynamic values. Which are
unique user to user or session to Session.
If you are passing the same value in the form of request server won’t accept the same.
To make our script work for multiple iterations we have to capture server generated from current
session pass it into next request. So that your request will be accept by server.

Q2. If the LB or RB is keep on changing. What is your approach to capture the dynamic
value?
Sol-1: If the dynamic LB is static use “Save offset” argument.
Sol-2: Use Flag system.
Flag System:
Any dynamic number is a part of LB we can use Flag System.
Ex-1: H1I Hero Welcome.
H2I Honda Welcome.
Sol: web_reg_save_param(“parametername”,”LB/DIG=H#I”,”RB=Welcome”,LAST);
Ex-2: If you’re LB contains dynamic alpha numeric characters use below solutions:
H1I Hero Welcome
H2I Honda Welcome
H3I Maruthi Welcome
Sol: web_reg_save_param(“vinay”,”LB/ALNUMIC=H^I”,”RB=Welcome”,LAST);

Alphabets
Numbers Indicate Case
Sol-3: Use strtok() to capture dynamic value (refer page no 38)
Sol-4: Use lr_save_searched_string() (refer page no 33)
Sol-5: Use Regular Expressions (refer page no 47)
Q3. To capture entire response for a request we have to pass empty LB & empty RB?
Sol: By default LR variable can hold 256 characters. If you decide to capture more than 256
characters. We have to allocate memory to the LR variable.
Ex: web_reg_save_param(“vinay”,”LB=”,”RB=”,LAST);
web_set_max_html_param_len(“1024”);
Note: 1024 is array size in bytes.

Page 13
Q4. What is your approach if LB or RB isn’t present for a dynamic value?
Sol: If the LB isn’t available take any static text from the above line pass it as a LB & identify
exact LB from the capture value & pass it as LB.
If the RB isn’t present in the dynamic value take any static text from the below line &
pass it as a RB & identify exact RB from the capture value & pass it as a RB.

Q5. How many ways you can find the LB, RB for a dynamic value?
Sol:
1. Generation log (which never change contains Response & Request).
2. Replay log: We have to execute script in Full mode then only we can identify the LB &
RB dynamic value.
3. Snapshot View or Tree View.
4. Capture entire response using empty LB, empty RB & identify the LB & RB.
5. Using View Source Option in page view.

Q6. My correlation function is keep on failing?


Sol:
1. Invalid LB or RB.
2. Function location might be wrong.
3. May be your trying to capture more than 256 characters.
4. May be the dynamic value itself not available the response.

Q7. What is your approach to capture the dynamic value, if the dynamic value is not
present in the response?
Sol: If the dynamic value is not present in the response speak with developer & try to understand
why & how the dynamic value is generating then get the same functionality (Code) make it as a
external function in VUGen & call the function to generate the dynamic value.
Ex:
OTP – whenever OTP is recorded in your script ask the developer to provide the code
which can generate the OTP.
CAPTCHA – Ask the developer to disable the captcha functionality. Which will
allowing to execute the script with multiple users.
(Or)
You can ask to provide a number which can match for any image.

Page 14
Q8. How many ways you can conduct correlation?
Sol:
1) Auto Correlation.
2) Manual Correlation.
3) Right click on dynamic value & click on “Correlate button” [Not available in 11.5].
4) Navigate to the snapshot view & find out the dynamic value.
5) Right click on choose Correlate button [From 11.5 on words this option isn’t available].
6) Correlation studio.
Using insert service option. [Not available from 11.5 on words].

Q9. If the dynamic value is generated buy a Java Script file & the same value is not
available in the response?
Sol: Speak with the developer understand how the dynamic value is generating. If it is generated
by Java Script file usually at Client side.
Get the Java Script ( ) create a “.js” file in extra files & call the function whenever you
like to generate the dynamic value.

Q10. If the dynamic value isn’t present in the response or it is a hidden value?
Sol: Use web_add_cookie( ) to pass the dynamic value.

Q11. My first request itself keep on failing. What could be the reason for this?
Sol: Write web_add_header( ) to make it pass.

Page 15
Parameterization:

Static input to the server or vary input to the server.


Note:
Which values you enter through keyboard those values should be parameterized. Your script
should not contain any hard coded values.

Parameter Types:
1. File
2. Date & Time
3. Iteration Number
4. Random Number
5. Unique Number
6. VUserID
7. Group Name
8. Load Generator Name
9. Table
10. XML
11. User defect

1. File:
Parameter Properties:
1) Sequential Each Iteration
2) Random Each Iteration
3) Unique Each Iteration
4) Sequential Each Occurrence
5) Random Each Occurrence
6) Unique Each Occurrence
7) Sequential Once
8) Random Once
9) Unique Once
10) Same line as some other parameter.

Page 16
1) Sequential Each Iteration:

Sequential - It stands for every user as to pick the “First Data Point”.
Each Iteration - Data point update has to “Update on Every Iteration”.

Users Data Point

(4TH) d

2) Random Each Iteration:


Users picks the values randomly.

Users Data Point

Page 17
3) Unique Each Iteration:
Every user has to pick “First Unused Data point”.
Users Data Point

e
f

4) Sequential Each Occurrence:


Value updates on every occurrence.
Users Data Point

5) Random Each Occurrence:

Users Data Point

Page 18
6) Unique Each Occurrence:

Users Data Point

b
c

d
e
f

g
h

7) Sequential Once:
If the user picks any 1 of the data point. We have to continue the same value for
all the iterations & occurrence.

Users Data Point

8) Random Once:
Users Data Point

Page 19
9) Unique Once:

Users Data Point

d
Note:
One to one mapping.

10) Same line as some other parameter:


In a scenario there is a dependent data (UN & PWD). We have to pick associated
value from second data file. Using same line as some other parameter option. We can
instruct the user to pick same row data point from second data file.

Complex Parameterization:
We can create one “.dat” file with multiple columns for dependent data. Complex
parameterization allow you to handle test data in a proper way.

2. Date & Time:


Using Date & Time parameterization we can pick current date, future date, past date in
require format.

Current Date:
Where you can choose the current date.
Note:
Data will pick from mission date from where it is executing.
Step1: Right click create parameter & choose Date & Time option.
Step2: Choose or create require parameter in parameter properties & click ok.

Future Date:
You can choose the future date from which mission script is executing.
Step1: Right click create parameter & choose Date & Time option.
Step2: Choose or create require parameter in parameter properties & click ok.
Step3: Choose offset date & provide the no. of dates.

Page 20
Past Date:
Where you can choose the past date.
Step1: Right click create parameter & choose Date & Time option.
Step2: Choose or create require parameter in parameter properties & click ok.
Step3: Choose offset date & provide the no. of dates.
Step4: We have to choose the prior to current date option.
Note:
Using working days option, we can skip weekends.

3. Random Number:
As per the business scenario we have to generate the random number in specified
boundaries in required format.

4. Unique Number:
We can generate the unique number using unique number parameterization by
providing Lower Boundary & Upper Boundary in required format.

Data Wizard: Will allow you to pull the data from database with the help of connection
string and query.

Simulate parameter: It will give an idea how the user will pick the values based on property
in controller.

By number: Indicating column number from which column user supposed to pull the data.

By name: Indicating from which column user supposed to pull the data based on column
name.

Column Delimiter: Values will be separated based on comma (,) or tab or space.
Note: If your data point contains comma, what is your approach to create .dat file?
Solution 1: Create tab or space based dat file instead of comma delimiter.
Solution 2: Keep the comma (,) in double quotes (“”)

First Data line: Indicating the row number from which row user supposed to start picking
the value.
Note: You can load 36000 data points in a script.

When out of values: This option is available for unique-each iteration/each occurrence.
Instructing the user abort the execution or continue in cyclic manner or continue with the last
value when there are no unused data points.

Page 21
Block concepts in parameterization:
Block concepts is available for unique-each iteration/each occurrence property data points
will be divided into blocks and allocated to users.
Option 1: Automatically allocate block size
controller itself allocates the block size based on number of user data points.
Option 2: Manually we can calculate and decide the block size.

Interview Questions:

What is parameter file extension?


A) .dat
- You can create various types of files like .dat or .xml or .csv
- You can’t create .xls as parameter file.
- You can create shared .dat file in between scripts

Verification points/checkpoints:
We have to verify whether we received proper response or not using below techniques
1) Text verification points
Famous
2) Image verification points
3) Response size Based On Protocol
4) HTTP status codes
5) Correlation function } Optional

Text verification points:


web_reg_find(“text=xyz”,LAST);
Note 1: Which request you are planning to verify, on top of the request you have to write this
function
Note 2: web_reg_find is a registered function. You have to write on top of request for
verification
Note 3: Preferrably use static text verification even you can use dynamic text for verification.

Checkpoint function:
web_reg_find(“text=welcome”,”savecount=xyz”,LAST);
After request, we have to write
If (strcmp(lr_eval_string(“{xyz}”),”0”)==0)
{
Lr_output_message(“text check failed”);
}else{
Lr_output_message(“text check passed”);
}

Page 22
Image verification:
It will verify the response based on image
Syntax: web_image_check(“xyz”,”SRC=c://image.gif”);
web_image_check is a non-registered function. We have to write after the request to make it
work. You have to enable option “enable text and image verification” in runtime settings.

Q: How many ways I can find image name?


1) Open application  Right click  Choose view source
2) Navigate to snapshot
3) In generation log
4) Full mode of replay log

Q: How can I find how many times text is present in response?


A: “savecount” will let you know the count of the text

Q: Difference between web_reg_find and web_find?


Web_reg_find Web_find
 It’s a registered function  It’s a non-registered function
 Have to write before the request  Have to write after the request
 Don’t require to enable any option  Have to enable text and image
verification in runtime settings
 Current version we are using this  It’s a deprecated function
function

Advanced Techniques
Note: We are going to use test script language (TSL) in load runner sometimes might require to
write C or Java to make our business scenario work. By default, we will use C language.
Note: We have only one data type in LR that is “string”
Note: We don’t require to declare LR variable.

C Data Types:
 Int,
 char,
 double,
 float,
 flag,
 long,
 short,
 Boolean etc

Page 23
Scripting Challenges

Q: What are the scripting challenges you faced so far?


(or)
What kind of C techniques you used so far?

Scenario 1:
How to convert an integer value to LR variable?
Solution: “itoa”  It converts integer to string
Lr_eval_string  It reads the value from a variable
Lr_output_message  It displays the message
Example:
Int x=0;
Char abc[100];
Itoa(x,abc,10); //Converting int to string
Lr_save_string(abc,”final”); //Assigning value to lr variable
Lr_output_message(“%s”, lr_eval_string(“{final}”));

Scenario 2:
How to generate random value from an array?
Solution:
Lr_save_string(lr_paramarr_random(“cSource”),”randSource”);

Scenario 3:
How to compare two LR variables?
Solution:
lr_save_string(lr_paramarr_random("c_source"),"Ran_Source");
lr_save_string(lr_paramarr_random("c_desti"),"Ran_Dest");
if(strcmp(lr_eval_string("{Ran_Source}"),lr_eval_string("{Ran_Dest}"))==0)
{
lr_output_message("SOURCE & DESTINATIONARE SAME, CANT BOOK
TICKET");
lr_abort();
}
else
{
lr_output_message("SOURCE & DESTINATION ARE NOT SAME, CAN
BOOK TICKET");
}

Page 24
Hari Hari Tech

Scenario 4:
How to compare two C variables?
Solution:
lr_save_string(lr_paramarr_random("c_source"),"rand_sorc");
lr_save_string(lr_paramarr_random("c_desti"),"rand_dest");
strcpy(source,lr_eval_string("{rand_sorc}"));
lr_output_message(source);
strcpy(desti,lr_eval_string("{rand_dest}"));
lr_output_message(desti);

if(strcmp(source,desti)==0)
{
lr_output_message("SOURCE & DESTINATIONS ARE SAME, CANT BOOK TICKETS");
}
else
{
lr_output_message("SOURCE& DESTINATIONS ARE NOT SAME, CAN BOOK TICKETS");
}

Scenario 5:
Working for a banking application. Capture the account holder balance and add 10 rs to
balance and substitute in the next request.
Solution:
y = atoi(lr_eval_string("{c_sid}"));
z=x+y;
lr_output_message("%d",z);
itoa(z,final, 10);
lr_output_message(final);
lr_save_string(final,"final_balance");

Hari Tech Page 25


Hari Hari Tech

Scenario 6:
How to use string tokenizer functionality?
Or
How to split a string into multiple strings?
Solution:
char* abc;
char xyz[100];

RESPONSE BODY

strcpy(xyz,lr_eval_string("{c_fno}"));
abc=(char*)strtok(xyz,";");
lr_output_message(abc);
lr_save_string(abc,"final");

Scenario 7:
How to split a string into multiple strings?
Solution:
char path[100];
char separators[] = ";";
char* token;
RESPONSE BODY
strcpy(path,lr_eval_string("{c_fno}"));
token = (char *)strtok(path, separators); // Get the first token
if (!token)
{
lr_output_message ("No tokens found in string!");
return( -1 );
}
while (token != NULL )
{ // While valid tokens are returned
lr_output_message ("%s", token );
token = (char *)strtok(NULL, separators); // Get the next token
}

AVNR Groups (July-16) Page 26


Hari Hari Tech

File operations:

Scenario 8:
How to write a value to a local file?
Solution:
long file;
RESPONSE BODY
file=fopen("D:\\vny_src.txt","a+");
fprintf(file,"SESSION ID : %s\n",lr_eval_string("{c_sid}"));
fclose(file);

Scenario 9:
How to write multiple values/array values into local file?
Or
How to write a for loop?
Solution:
long file;
int i,cnt;
char* temp;
RESPONSE BODY
cnt=atoi(lr_eval_string("{c_desti_count}"));
for(i=1;i<=cnt;i++)
{
temp=lr_paramarr_idx("c_desti",i);
lr_save_string(temp,"F_dest");
file=fopen("D:\\vny_dest.txt","a+");
fprintf(file,"SOURCE IS : %s\n",lr_eval_string("{F_dest}"));
fclose(file);
}

Scenario 10
How to generate a random value from an array without using lr_paramarr_random
function?
Or
How to concordant two lr variables?
Or
How to use atoi and itoa functions?

AVNR Groups (July-16) Page 27


Hari Hari Tech

Solution:
int cnt,x;
char* temp;
char abc[10];
RESPONSE BODY
cnt=atoi(lr_eval_string("{c_desti_count}"));
x=1+rand()%cnt;
lr_output_message("%d",x);
itoa(x,abc,10);
lr_save_string(abc,"F_dest");
temp=lr_eval_string(lr_eval_string("{c_desti_{F_dest}}"));
lr_save_string(temp,"final");

Scenario 11
Working for a banking application. Capture the account holder balance and add 10.25 rs
to balance and substitute in the next request.
Solution:
float x=10.75,y,z;
char final[100];
RESPONSE BODY
y = atof(lr_eval_string("{c_sid}"));
lr_output_message("%.2f",y);
z=x+y;
lr_output_message("%.2f",z);
sprintf(final,"%.2f",z);
lr_output_message(final);
lr_save_string(final,"final_balance");

Scenario 12
How to download a pdf/doc/xls from an application?
Or
How to use VuserID and iteration number parameter?
Or
How to generate time stamp in milli seconds?
Or
How to create a buffered variable?
Or
How to create unique file naming convention?

AVNR Groups (July-16) Page 28


Hari Hari Tech

Solution:
long file;
unsigned long paramlen;
char* newparam;
web_save_timestamp_param(“tstamp”,LAST);
file=fopen(lr_eval_string(“D:\\anand_{puser_id}_{p_iteration}_{tstamp}.pdf”),”wb”);
lr_eval_string_ext(“{vinay}”,strlen(“{vinay}”),&newparam,&paramlen,0,0,-1);
fwrite(newparam,paramlen,1,file);
fclose(file);

Pre-defined functions:
LR Functions:
LR functions you can use across the protocols.

1. lr_abort();
This function use for script abort purpose .
example:
if (strcmp(lr_eval_string("{ramana}"), "0") == 0)

{
lr_output_message("Login Failed");
lr_abort();
}
else
{
lr_output_message("Login PASSSSED");

2. lr_exit():
Exits the iteraion or action.
Arguments:
LR_EXIT_USER
LR_EXIT_ACTION_AND_CONTINUE
LR_EXIT_MAIN_ITERATION_AND_CONTINUE
LR_EXIT_ITERATION_AND_CONTINUE
LR_EXIT_VUSER_AFTER_ITERATION.

AVNR Groups (July-16) Page 29


Hari Hari Tech

Example:
if (strcmp(lr_eval_string("{ramana}"), "0") == 0)

{
lr_output_message("Login Failed");
lr_exit(LR_EXIT_MAIN_ITERATION_AND_CONTINUE, LR_FAIL); // here v
can change the above arguments.......
}
else
{
lr_output_message("Login PASSSSED");
}

3. lr_start_transaction() &lr_stop_transaction():
Allow you to measure the response time for a page/request.
lr_start_transaction("launch"); //here launch is txn name. this statement write on top of request
lr_stop_transaction("launch"); //this statement write after the request

4. lr_stop_transaction() &lr_resume_transaction():
Transaction will be stopped and resumed based on requirement

5. lr_start_timer() &lr_end_timer():
This function will allow you to calculate wasted time. Nowadays you don’t require to calculate
wasted time which will be measured by LR itself.

double time_elapsed, waste;


merc_timer_handle_t timer;
timer = lr_start_timer(); // this should write after the web function. or after start
transaction
time_elapsed = lr_end_timer(timer);// this should after the web_reg_find function or
before ending transaction

waste = time_elapsed * 1000; // Convert to millisecond.s

lr_wasted_time(time_elapsed); /* Remove the time the checks took from the


transaction. */
lr_output_message("%lf",time_elapsed);

6. lr_save_string():
It assigns a value to LR variable
Ex: lr_save_string("abc","xyz");

AVNR Groups (July-16) Page 30


Hari Hari Tech

7. lr_save_int():
It assigns integer value in to LR variable.
this also used instead of itoa function.
lr_save_int(x, "xyz"); // here X is a integer

8. lr_eval_string():
It evaluate the value after embedding parameter or it reads the value.

9. lr_paramarr_random():
It generates the random value from an array.
lr_paramarr_random("source");

10. lr_paramarr_idx():
Returns the value of the parameter at a specified location
lr_paramarr_idx("source",10); // it reads 10 th value of source.

11. lr_save_datetime():
Assigns the current date and time to a parameter.
Ex:
lr_save_datetime("%m/%d/%Y %H:%M", DATE_NOW, "currDateTime"); // This statement
write in output message area(after the request)

12. lr_set_debug_message():
Changes the message level for a request
Syntax:
lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG |
LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_ON );
web_url()
---

lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG |
LR_MSG_CLASS_FULL_TRACE, LR_SWITCH_OFF );
Note:Here we need to set standard mode in Runtime Settings.

13. lr_db_connect():
It connects to database with the help of connection statements

14. lr_db_disconnect():
It disconnects from the database

AVNR Groups (July-16) Page 31


Hari Hari Tech

15. lr_db_executeSQLstatements():
Submits SQL statements to database

16. lr_continue_on_error():
On error, scripts use one of these options for continuation:
Syntax:
lr_continue_on_error(0); ------- > no option
lr_continue_on_error(1); ------- > continue
lr_continue_on_error(2); ------- > skip to next Action
lr_continue_on_error(3); ------- > skip to next iteration
lr_continue_on_error(4); ------- > end user

17. lr_load_dll():
The lr_load_dll function loads a DLL (Windows) or shared object (Linux) allowing you to call
an external function when replaying using the C interpreter.
Once you load the DLL, you can call any function defined in the DLL, without having to declare
it. You can specify a full path for the DLL.
Syntax:
lr_load_dll("user32.dll");

18. lr_out_message():
It's sends a message to log file,output windows and summary report

19. lr_log_message():
Sends a message to logfile to the application management agent logfile (or) vuser log.

20. lr_message():
Sends a message to the log and o/p window.

21. lr_error_message():
Sends an error message with location details to the output windows, log files, and other test
report summaries.

22. lr_get_vuser_ip():
Returns the ip address of the user
Syntax:
char* ip;
Ip= lr_get_vuser_ip();

AVNR Groups (July-16) Page 32


Hari Hari Tech

23. lr_get_host_name():
Returns the name of the host
Syntax:
char* name;
Ip= lr_get_host_name();

24. lr_get_master_host_name():
Retrieve the controller machine name

25. lr_whoami():
Returns the information about vuser

26. lr_vuser_status_message():
Sends a message to vuser status area in controller

27. lr_save_searched_string():
It will captures substring from a main string
Syntax:
ex: for flight number 300;365;05/08/2016

char abc[100];
//this code write after the request
no option
strcpy(abc,lr_eval_string("{outboundFlight}"));

lr_save_searched_string(abc, strlen(abc),
1,";", //Searched for 2nd occurrence of “;”
0, //Indicates no skip after “;”
3, //Captures next 3 characters
"year"); // here year is final value (or )abc saved in year

AVNR Groups (July-16) Page 33


Hari Hari Tech

Web Functions:

These functions we can use only in web protocol.

GET POST
1. Not a secured request 1. It’s a secured request
2. It will send small amount of information to 2. Sends large amout of information
server
3. It can be available in history, cached and 3. It can’t be available in history, cached and
bookmarks. bookmarks.
4. To retrieve the information 4. To submit the data to server
Note: Method types  Get, Post, Put, Options etc
Note: “Resource = 0” indicating it’s a html resource it’s downloading a html page.

1. web_url():
To launch the application or load the specified URL.

2. web_set_max_html_param_length():
Sets the maximum length of any html string that can be retrieve and stored in a variable.
Syntax: web_set_max_html_param_length(“1024”);

3. web_save_timestamp_param():
Save the timestamp to a parameter. It generates a timestamp in milliseconds which is a 13 digit
number.
Syntax: web_save_timestamp_param(“tstamp”,LAST);
lr_output_message(“%s”, lr_eval_string(“{tstamp}”));

4. web_reg_save_param():
Allow you to capture dynamic value from response.

5. web_reg_save_param_ex():
Allow you to capture dynamic value which is introduced from 11.0 version. It has different
parameters.
web_reg_save_param web_reg_save_param_ex
1. Parameter name 1. Parameter name = xyz
2. Before ORD = 1 2. Now ORDINAL = 1
3. Before search = header/body 3. Now scope = body
4. RelframeID = 1.2.1 4. RequestURL = URL
5. They added content type, data execution
format (def) arguments
6. They deprecated convert argument.

AVNR Groups (July-16) Page 34


Hari Hari Tech

6. web_reg_find():
For text verification purpose.
Syntax: web_reg_find("Text=Welcome","SaveCount=Welcome_Count", LAST );

7. web_find():
Text verification purpose. It is deprecated.

8. web_image_check():
Image verification purpose.
Syntax: web_image_check("Text=Welcome", "src=D:\\xyz.gif", LAST );

9. web_set_proxy():
Specifies that all requests should be redirected to a specific proxy server.
Syntax: web_set_proxy(10.10.10.10:8080);
Note: Default port number of https request  443
Default port number of http request  8080

10. web_submit_data():
It is an unconditional context less request which will submit data in form of item data.

11. web_submit_form():
It submits the form and context based request. Submit data in the form of item data.
Note: Context based means request will be dependent on previous response.
Note: Usually we are using web_submit_data option to record scenario.

12. web_get_int_property():
Using this function, you can verify response whether it is proper or not based on HTTP status
codes and download size
Syntax:
int HttpRetCode = web_get_int_property(HTTP_INFO_RETURN_CODE);
lr_output_message(“%d”, HttpRetCode);
if(HttpRetCode == 200){
lr_log_message(“Script passed”);
}else{
lr_log_message(“Script failed”);
lr_abort();}

Q: How to capture download size for a response?


A:web_get_int_property(HTTP_INFO_DOWNLOAD_SIZE);

AVNR Groups (July-16) Page 35


Hari Hari Tech

13. web_set_user():
For all NTLM (Native Windows Authentication) Applications, we should submit the credentials
against web_server.
Syntax:
web_set_user(“CA:\\Jojo”,”Bean”, HTTP://webtours.kword.com:80);

14. web_set_certificate():
Causes a script to use a specific certificate that is listed in internet explorer registry
Syntax: web_set_certificate (“2”);
Extension: .prm/.cer/.pem

15. web_set_socket_option():
Setting the socket level option for a request
Syntax:
web_set_socket_option(“SSL_VERSION”, “TSL1.1”);
Instead of using above function, you can execute the script using wininet engine but which is not
preferable.

16. web_cleanup_cookies()& web_cache_cleanup():


These functions will allow you to cleanup cookie files and cache files from browser. Have to
write these functions at end of the script.

17. web_convert_param():
Which will convert a string html to url and url to plain vice versa.
Syntax:
web_convert_param("HTML", "SourceEncoding=HTML", "TargetEncoding=URL", LAST );
web_convert_param("HTML1","SourceEncoding=HTML", "TargetEncoding=PLAIN", LAST );
web_convert_param("Plaintext", "SourceEncoding=HTML","TargetEncoding=URL", LAST );

18. web_add_header():
Scenario 1: My first/any request keep on failing even after conducting correlation and
parameterization
Solution: Write web_add_header() function on top of request.
Step 1: Verify correlation and parameterization.
Step 2: Verify whether the page is opening manually or not. If it is opening, then problem is with
header.
Step 3: Verify whether we need to add any SSL.

AVNR Groups (July-16) Page 36


Hari Hari Tech

Q: How to add header information?


Sol:
Step 1: Right click on request and choose snapshot view
Step 2: Verify record time and replay time headers
Step 3: If there is a difference, please add information using web_add_header() function.

19. web_custom_request():
It will submit the data in the form of body.
Scenario 1: Based on my previous input, number of fields are changing in current page.
Scenario 2: When I am accessing application in morning, it reported 10 records. In the evening
15 records, next day 20 records. How to make it work for anytime?
Scenario 3: How to write web_custom_request()
Scenario 4: Client asked me to book random number of tickets for every user but based on
random number, number of passenger fields are changing in payment page. How to make my
script work for vary number of passengers?
Sol:
int xyz;
char abc[100], lmn[100];
xyz=atoi(lr_eval_string(“{prandpass}”);
for(i=1;i<=xyz;i++)
{ sprint(abc,”pass%d=”, i); //pass1=
strcat(abc,lr_eval_string(“{ppass}”)); //pass1=anand
strcat(abc,”&”); //pass1=anand&
strcat(lmn,abc); }
lr_save_string(lmn,”r_no_pass”);

Q: How to read a value from a local file?


Sol:
char buffer[100];
long file;
file = fopen(“D:\\xyz.txt”,”r+”);
freadf(buffer,sizeof(char), 20, file);
lr_save_string(buffer, “read_value”);
return 0;

Q: How to write a do while condition?


Sol:
do{ web_reg_find(“Text-departure”,”savecount=xyz”,LAST);
web_url(“Search Flight Button”,
}while(atoi(lr_eval_string(“{xyz}”))==0);

AVNR Groups (July-16) Page 37


Hari Hari Tech

C Functions:

1. strcpy()
Copies one string to another
Syntax:
Char hi[10];
Strcpy(hi,”747”);

2. strcmp()
Compares two strings
Syntax:
Strcmp(hi,rao);

3. strcat()
Concatenates two strings
Syntax:
Strcat(abc,”&”);

4. strlen()
Returns length of the string
Syntax:
Strlen(abc);

5. strstr()
Captures substring from main string

6. strtok()
Tokenize the string based on delimeter
Syntax:
xyz = (char*) strtok(abc,”;”);

7. strncpy()
Copies n number of characters to another

8. sprint()
Writes a formatted output to a string

AVNR Groups (July-16) Page 38


Hari Hari Tech

File Operation Functions:

1. fopen()
Opens a new/existing file

2. fwrite()
Writes an unformatted data to file

3. fprintf()
Prints a formatted value to a file

4. fread()
To read the data from a file

5. fclose()
Closes the file

User Defined Functions:

Function: Set of reusable statements is called function which has to return something.

Syntax:
vuser_init()
{
Return 0;
}

Note: Dividing you script statements into multiple functions is called modular approach

Q: How to create dynamic transaction name convention?


Or
How to declare a function?
Or
How to call a function?
Or
How to overwrite the .dat file properties using lr_next_row() and lr_advance_param()
function?

AVNR Groups (July-16) Page 39


Hari Hari Tech

Sol:
lr_start_transaction(lr_eval_string(“login_{puser}”));
web_reg_find(“text=welcome”, “savecount=xyz”,last);
web_submit_data(“login.pl” //request

if (strcmp(lr_eval_string(“{xyz}”),”0”)==0)
{
lr_output_message(“text check failed”);
lr_end_transaction(lr_eval_string(“login_{puser}”),last);
login();
}
else
{
lr_output_message(“text check passed”);
lr_end_transaction(lr_eval_string(“login_{puser}”),last);
}

Q: How to create a header file?


Or
How to use function across the project?
Or
Example for modular approach
Or
How to create a framework in LR?

Sol:
Step 1: Open the notepad.
Step 2: Write the statements into notepad.
Step 3: Save it as “.h” file.
Step 4: Keep it in shared drive.
#include “D:\\AR_H.h”
(In this scenario we are saving file in specific drive)
Step 5: If you are saving header file into bin directory, then you don’t required to mention path
Note: Even you can include this file into extra files.

AVNR Groups (July-16) Page 40


Hari Hari Tech

Header file code:


#ifdef _AR_H
#define _AR_H

int sum(int a, int b, int c)


{
return a+b+c;
}
#endif //_AR_H

Calling from Script:


#include AR_H.h
{
int z;
z=sum(10,20,30);
lr_output_message(“%d”, z);
}

Note: vuser_init() contains logic procedure.


action() contains business procedures.
vuser_end() contains logoff procedure.
Note: You can iterate only action() part.
Note: You can create multiple actions.

Scenario 1:

In one of my business scenario, user has to login to application once and has to perform
business scenario 10 times, then logoff from application

Sol:
To achieve above scenario:
Record:
Login procedure into vuser_init()
Business procedures into action().
Logoff procedure into vuser_end().

AVNR Groups (July-16) Page 41


Hari Hari Tech

Scenario 2:
User has to login to application, book and cancel tickets for multiple times. Every iteration
has to perform login and logoff
Sol:
Everything has to be recorded into action().

Scenario 3:
How to create multiple actions?
Sol 1:
While recording itself we can create multiple actions.
Sol 2:
We can create new action using create new action option.
Note: If the actions are not calling from run logic, those will be faded out.

Scenario 4:
In one of my scenarios, have to book tickets for 10 times and cancel the ticket for 5 times
Or
Have to approve the loan 100 times and cancel the loan 40 times
By creating blocks in the run logic,
We can achieve the above scenario
Step 1: Go to run logic.
Step 2: Create insert block.
Step 3: Insert actions into block.
Sol 1:
Create two blocks. Insert book action into 1st block, cancel action into 2nd block. Provide block
level iteration.
Sol 2:
Using for loop also, you can achieve above scenario.

Scenario 5:
In one of my loan application, 70% loan has to be approved. 30% loan has to be rejected
irrespective of the number of iterations.
Sol:
To achieve above scenario, I will insert both of the actions into one block and provide the % by
choosing random property.
Note: Script extension is .usr
Default script folder contains below files:
Data folder, vuser_init, action, end notepad, global.h, default.cfg, default.usp files,
breakpoints file, custom_body_variables, ReplaySummaryReport, .usr file.

AVNR Groups (July-16) Page 42


Hari Hari Tech

Scenario 6:
Scrubbing method for multiple users?
or
I have received 10000 users some of them are not working. How to segregate which are
working, which are not working?
We need to do parameterization for user name and password
long file;
long file1;
web_reg_find("Text=Welcome","Savecount=ramana",LAST);
web_submit_data("login.pl",

if (strcmp(lr_eval_string("{ramana}"),"0")==0)
{
lr_output_message("Text check failed");
file= fopen("E:\\invalid.txt","a+");
fprintf(file,"invalid:%s\n",lr_eval_string("{pUser}"));
fclose(file);
lr_exit(LR_EXIT_ITERATION_AND_CONTINUE,LR_FAIL);// SCRIPT FAILED
MESSAGE WILL DISPLAYED, BUT SCRIPT PASSED FOR OTHER ITERATIONS.

}
else{
lr_output_message("text check passed");
file1= fopen("E:valid.txt","a+");
fprintf(file1,"valid:%s\n",lr_eval_string("{pUser}"));
fclose(file1);
}

Hari Tech Page 43


Hari Hari Tech

Recording Options:
Shortcut (Ctrl + F7)

1. Recording:
We do have two modes in HTTP/HTML protocol
1) HTML Mode
2) URL Mode
HTML Mode: Generates a separate step for every user action even you can record non HTML
resouces.
HTML Advanced: Using advanced techniques, you can record web_submit_form or
web_submit_data/
Usually we will use web_submit_data along with record within script.
Advantages:
 Easy to understand the script.
 Easy to maintain the script.
 Very less number of lines of code.
 Generate script for HTML and non HTML resources.
 Script never fails for non HTML resources. If any one of non HTML resource is not
available, it will throw a warning like resource unavailable HTTP status code 403.
URL Mode: Records not only user actions, even it records server side resources too. It will
generate web_custom_request and web_url.
 You can find huge number of lines of code.
 It’s very difficult to maintain the script.
 It will record non HTML resources in the form of concurrent groups.
 URL mode prefers for non-browser specific applications.
If any one of non HTML resource is not available or failed to download, the same script will be
aborted by throwing an error.
If application having java script files, prefer to use URL mode.

Q: In which scenario you are going to use URL mode?


Scenario 1: My application is a non browser specific application. So we use URL mode to make
ensure that all resources should be downloaded.
Scenario 2: My application downloading lot of java files for every page. So we use URL mode
to make ensure that every java script file has to be downloaded.
Note: Request will be recorded in between web_concurrent_start and web_concurrent_end in
between both of the function we can’t write anything like think time, transaction name.

2. Script:
Script option will allow you to generate the auto think time, limits number of lines in a script.

Hari Tech Page 44


Hari Hari Tech

3. Protocols:
Displays opted/chosen protocol.

4. Code generation:
Allow you to conduct auto scan for dynamic values.

5. Configuration:
Dealing with only auto correlation by specifying record scan, replay scan, rules scan, correlation
function, min and max length of dynamic value.

6. Rules or Correlation Studio (till 11.0):


We can create our own rules for common dynamic values. Those rules will be used across the
project.
Step 1: Create new application.
Step 2: Create new rule by providing LB, RB, param.
Note: We have to select boundary based scan type
Step 3: Test the rule.
Step 4: You can export the rule by clicking export button.
Step 5: You can import the rule by clicking import button.
Note: Correlation rule extension is “.cor”

7. Advanced:
We can generate auto text verification function using this option.
We can generate auto headers.

8. Mapping and Filtering:


Q: I am recording a business scenario but I failed to record the events.
Solution:
If you failed to launch the application, then change the DEP (Data Execution Prevention) settings
in my computer properties.
My Computer
Properties
Advanced System Settings
Advanced Performance Settings
DEP
Choose turn on DEP for all programs.

Q: Application is launching, events are generating but script is not available.


Solution 1: Problem might be SSL encryption.
Solution 2: Problem might be with browser compatibility.

Hari Tech Page 45


Hari Hari Tech

Q: Events and Scripts both are not generating


Solution 1: Problem might be with protocol.
Solution 2: Change the capture level, socket level to wininet.
Solution 3: Verify whether auto SSL is enabled or not.
Solution 4: Verify the port numbers.
Solution 5: Still if you are not able to record, record the communication using Fiddler, convert
Fiddler request to Vugen request.
Socket level data: For all web based applications, we have to use this option.
Wininet data: For all NTLM based application or window based applications, we have to use
this option.

Q: How many ways you can conduct correlation?


Solution 1: Through Design Studio.
Solution 2: By right clicking on dynamic value and choosing correlation selection.
Solution 3: Navigate to snapshot viewtree viewselect dynamic value from
responsechoose create correlation.
Solution 4: Navigate to snapshot viewfind out dynamic valuechoose create correlation.
Solution 5: From generation log.

Q: How many places you can find server response?


 Full mode of replay log.
 Generation log.
 Snapshot view.
 Tree view.
 Empty LB and empty RB function.

6. Test Data:
Usually you will get test data from DBA’s. While developing the script itself, we have to prepare
a test data requirement sheet which contains which required for every use case how much test
data you required and segregate which is reusable and which is not.
Sometimes you can generate test data using LR script itself.
Example: You can create username and password if the signup functionality is available in the
application. If the functionality is not available to generate test data, we have to request DBA to
provide it.
If the test data is not reusable, we have to request DBA to create database restoration point or
take the flashback of database.
Scenario 1: Once the test is completed, we have to request DBA to change DB to previous
restoration point. So that data will be available for next test.
Scenario 2: Once the test is completed, we have to request DBA, flashback the database or load
previous database instance.

Hari Tech Page 46


Hari Hari Tech

Scenario 3:
Q: One of the script is generating purchase order number and second script is processing
same purchase order number. What is your approach to design the script?
Or
How to pass value from one script to another?
Solution 1: Create two actions in one script for both of the scenarios. Capture purchase order
number from 1st action and pass into the second action.
Solution 2:
Data Staging:
Execute the first script with multiple users in controller. Write purchase order numbers into local
file before starting actual test. Copy purchase order numbers from local file. Load into second
script so that both of the script will execute simultaneously.
Solution 3:
VTS (Virtual Table Server):
Virtual Table Server is a tool that enables sharing of test data and parameters between
Load Runner Virtual Users (VUsers). Usually performance testers use parameterization in their
scripts, but in Virtual Table Server it acts as centralized repository to store data which can be
shared between VUsers during the test execution.

Hari Tech Page 47


Hari Hari Tech

Regular Expressions:

Whenever you have dynamic LB & RB, we can use regular expressions. This function works on
expression but not on boundaries.
Steps to construct regular expressions:
Step 1: Copy the LB & RB from generation log.
Step 2: Construct the expression.
Step 3: Validate inwww.rubular.com
Step 4: Write web_reg_save_param_regex() function.

Example:
web_reg_save_param_regex(“parameter name = reg_exp”, “regex=name =\” u[a-z]er[A-
Z]ession\” \\value=\”(.*?)\” , LAST);

u[a-z]er[A-Z]ession  Function searches for userSession based on this regular expression. [a-z]  Skips any
single character in the range a-z
[A-Z]  Skips any single character in the range A-Z

Note: Refer regex quick reference in www.rubular.com to construct regular expression.

Hari Tech Page 48


Hari Hari Tech

Fiddler:

Fiddler is a web debugging tool or stripping tool.


Fiddler versions:
2.2, 2.4, 2.5, 2.6. 4.4
Q: Why do we fail to launch the application in vugen sometimes?
Reasons:
 DEP settings
 Protocol selection
 Browser compatibility
 Wininet level/socket level
 Fiddler
When we failed to record some objects using vugen, we can use fiddler to record the
communication.
Fiddler file extension is “.saz”

Q: In one of my application, we failed to record some of the get and post requests.
Solution: We used fiddler to develop the script.

Scenario 1: How to convert fiddler get request to vugen get request?


Solution:
Select the request in fiddler.
Right click and copy just url.
Write web_url in vugen and construct a request.

Scenario 2: How to convert post requests?


Solution:
Select the request in fiddler.
Right click and copy just url.
Go to inspectors panel.
Choose text view and copy the content.
Using above just url, content and construct the web_custom_request.
In current version of LR, we can directly open the fiddler file.

Hari Tech Page 49


Hari Hari Tech

CONTROLLER

Note: Controller extension is “.lrs”.

Manual scenario: Manually we have to design the scenario by providing ramp up, ramp down,
duration, number of users to generate the anticipated load against the application.

Percentage mode: It will distribute the load in between use cases in terms of percentage.

Goal oriented scenario: Controller itself will design the scenario as per the goal.

 Controller having 3tabs:


1. Design tab.
2. Run tab.
3. Diagnostics tab.
1. Design tab: where you can design the scenario.
Note: scenario extension is “.lrs”.
 Ramp up: gradually increasing the load against application.
 Duration: indicates test duration which extends ramp up and ramp down time. this is
called “duration”, ”standalone”, ”steady time”.
 Ramp down: gradually reducing load from application.
 Elapsed time: this is the test duration time which includes ramp up, steady time, ramp down.
 Throughput: bits received from server.
 Hits per second: per second how many hits happening.
 Schedule by scenario: it considers all the scripts like a scenario and configure ramp up,
ramp down, duration.
(or)
Consider as a scenario by sharing ramp up, ramp down, duration.
 Schedule by group: every script consider as a different scenario by having their own
ramp up, ramp down, duration.
 Real world schedule: allow you to create multiple actions (ramp up, ramp down,
duration).
 Basic schedule: you have only basic action under this option (one ramp up, one ramp
down).

Hari Tech Page 50


Hari Hari Tech

2. Run tab:
 User status:
Down
Pending
Initialization
Ready
Run
Rendezvous
Passed
Failed
Error
Gradual exiting
Exiting
Stopped
 Gradual exiting: whenever test duration completed by the time user are in mid of
iteration. So those users will be moved to gradual exiting once the iteration is finished
users will be come out from test.
Note: elapsed time stats whenever you hit the start button.
3. Diagnostics tab: By default web page diagnostics are available at free of cost. We have to buy
license for java, Siebel, sap, oracle etc.

Manual scenario:
 Check list:
1. Choose manual scenario.
2. Push the script into controller.
3. Choose schedule by scenario (or) schedule by group.
4. Choose real world (or) basic schedule.
5. Assign the quantity.
6. Assign load generators.
7. Verify connectivity with LG’s.
8. Configure SLA’s (if required).
9. Configure runtimes settings for every script.
10. Set the result path.
11. Provide ramp up, ramp down, duration.
Note: whenever situations demands like every script should run for multiple durations with vary
ramp up’s then you can choose schedule by group.

Differences between request and hit:


User action is a request.
Successful request is a hit.

Note:One request may contains multiple hits.

Hari Tech Page 51


Hari Hari Tech

 Goal oriented scenario: controller itself will design the scenario according to goal.
 Check list:
1. Choose goal oriented scenario.
2. Push the scripts into controller.
3. Click on edit scenario goal.
4. Provide profile name.
5. Provide goal type and threshold point.
6. Provide max and min users.
7. Provide duration once it reaches the goal.
8. Configure notifications if it is not able to reach goal.
9. Distribute load in terms of percentage.
10. Assign LG and check the connectivity.
11. Configure SLA’s (if required).
12. Set the result path.
Note: Goal types
1. Virtual users.
2. Transaction per second.
3. Hits per second.
4. Response time.
5. Pages per minute.

IP Spoofing:
Masking the original IP address and using the different IP address is called IP spoofing.

Whenever load balancer is not functioning. Due to the request source of IP address. We
have to mask the original IP address and mask sure that every user has to use different IP
address.
Process: In realistic environment every end users using different IP address to access the
application but in LR environment all the users are invoking from same LG and same IP which is
not realistic.
Step1:Request IT infrastructure guys to provide dynamic IP address.
Step2: Ask them to configure these IP address in DHCP server.
Step3: We have to configure these IP address in load generator using IP wizard option.
Step4: Enable IP spoofing option in controller.
Load balancing: Load balancer is a URL, which will distribute load in between web instances.
As part of performance testing you will receive two kinds of URL.
1. Direct URL: It will access web instance directly.
2. Load balancer URL: which will distribute the load in between web instances.
We do have two types of load balancer
1. Hardware load balancer
2. Software load balancer

Hari Tech Page 52


Hari Hari Tech

Among the above, hardware load balancer is accurate and good


Load balancer URL will distribute the load based on below algorithms.
1. IP sticky
2. Least connections
3. Round robin
4. Round passion
5. Least load

Q: While running the test how to verify whether load balancing is happening properly are
not?
A:While running the test we have to monitor resource utilization (C.P.U and Memory) each and
every instance. If all the instances are using same level of C.P.U and memory, then we can
conclude that LB is happening properly. If any one of the instance reporting less C.P.U memory
utilization then we have to conclude LB is not happening properly.

Q: What are the actions you can perform while running the test?
A:
1. Add the users.
2. Delete or kill the users.
3. Add the script.
4. Disable or delete the script.
5. Verify the user runtime viewer.
6. Verify the user log.
7. Verify how many users running currently.
8. Add or change the LG for down status users.
9. Identifying which transactions are passing and failing.
10. Verify who the users are ramping up, throughput, hits per second, connections, response
time and resource utilization.

Q: How to verify the errors for which request, which user, which LG, which line number,
which script, how many time occurred, which user id?
A:
Check list:
 Click on errors.
 Verify each and every error for which script it was occurred by choosing script
column.
 Verify which LG it was occurred by choosing generators column.
 Verify which user id causing the issue by choosing vuser id column.

Hari Tech Page 53


Hari Hari Tech

Runtime settings:

Extension of RTS is “.cfg” & “.usp”.


Note: RTS will be transferred to controller from vugen script but not vice versa.

1. Run Logic: Indicates number of Iterations.


Note1: Test duration setting will override the Run Logic.
Note2: To make our script iterates for specific number of iterations, we have to choose “run until
complete”.

2. Pacing: Time delay between the Iterations


We have 4 types of Pacing.
1. No pacing/ no delay.
2. Fixed Pacing, waiting time.
3. Random Pacing (generate random value and wait for the same).
4. Interval Pacing: Instructs users to finish with in a time, which includes pacing time, iteration
time.
Note1: Pacing is the time delay to start new iteration after finishing previous iteration.
Note2: Pacing will allow you to control the number of iteration and number of transactions.
Note3: Pacing calculation is very important while preparing work load model.

3. Log: Logs will help you to debug the script.


 Enable logging: You will receive log messages based on the settings.
 Disable log: You are going to use this option while running the test to avoid unnecessary

4. Think time:
Think Time is the time to choose new action after getting previous response.
(or)
Time delay b/w the User actions.
Note: Even you can pass float numbers as a think time.

Q: Why think time is required?


A:
In realistic environment end users are taking sometime to choose the new action after receiving
previous response.
But in my script virtual users are not waiting for to choose the new action and they are firing
back to back request.
To simulate the realistic environment we have to instruct the users to pause in between the
request with the help of think time.

Hari Tech Page 54


Hari Hari Tech

Q: Who is going to provide the think time?


A:
As a performance tester we have to calculate the think time. How long a normal user is waiting
to choose the new action on every page.
Note: we should not use recorded think time.
Think time option:
1. Ignore Think time: It is going the function and execute back to back request.
2. As Recorded: It will pause the script execution as per the function time.
3. Multiply think time: Multiplies the think time.
4. Random Think time: it will generate the random number based on minimum and maximum
percentage and passes the same.
5. Limit Think time: It limits the think time.

Q: Where do you place the think time?


A: We should not place the think time in between start and end transaction.

Q: What is the impact of think time on the response time?


A:
Scenario1:
If you reduce the think time you will receive higher response time. Because of less think time
users will perform more iterations and transactions, which will impact the server
performance.
 Lower think time will give less breathing time, which will impact the transaction
response time.

Scenario2:
 Higher think time will give good response times.
 Due to the higher think time server will get more breathing time which will process the
request very fast.

Global think time:


Define the variable in global.h

Ex: int X=10;


lr_think_time(x); (Action)

Note: If we forgot to take out the think time from start to end transaction you can filter those
response times in lra file with the help of properties.

Hari Tech Page 55


Hari Hari Tech

5. ADDITIONAL ATTRIBUTES:
To declare the Environment variables.

Q: How to create environment variables in LR?


(or)
How to pass a new value in to the script without opening the script?
A:
char * server;
server = lr_get_attrib_string(“host”);
lr_save_string(server,”url”);
 Write the above statement in the script.
 Set the value in the RTS and pass vary arguments in runtime.

6. Miscellaneous:
Continue on Error:
Continue script execution even when an Error Occurs.
Generate snap shot on Error:
It will generate the snap shot for every Error you can verify them in Result file (or) Controller
vuser log (by clicking camera symbol).
Q: Where we can find a screen shot?
A: Go to the vuser log and click on the camera symbol.
Navigate to the LG results path and you can find HTML page for every error.

Multithreading:

Run vuser as a process:


For all client server apps (SAP GUI or Desktop based apps. EX: SAP GUI/ Calculator) you have
to run vuser as a Process.
If we are running vuser as a process every vuser required one MDRV (Multi Driver Program)
Engine.
Every MDRV engine required 5Mb memory in the LG Machine.

Running Vuser as a Thread:


For all web based applications you have to run vuser as a Thread. If you are running vuser as a
thread multiple users will share one MDRV engine.
NOTE: Approximately 50 vusers use one MDRV engine.

Automatic Transaction:
Allow you to generate the automatic transactions to measure the response time.

Hari Tech Page 56


Hari Hari Tech

7. Network:
Speed simulation:
It specifies to use maximum/ predefined/ custom band width for your test.
Usually we are using maximum bandwidth option until or unless there is a requirement, we are
not going to use custom or advanced bandwidth.
If you like to test your application with a specific network bandwidth, then use custom or
advanced bandwidth.

8. Browser Emulation:
It will allow you to use multiple browsers for test.
Note:
Prerequisites:
We should install the browser in the load generator.
1. Simulate browser cache: Enabling this option instructs the users to use or simulate cache
files from browser.
If disable this option, cache files will be deleted or will not be simulated.
2. Simulate a new user on each iteration: If the users are iterating for multiple times, we have
to make him behave like a new user on every iteration by enabling this option.

9. Internet Protocol:
Content check:
It is a global text verification option. Verifies the text on every page.
Note: web_reg_find is a local verification point.
Steps:
1. Create application by clicking new application.
2. Create a rule under the application.
3. Provide the text and match case.
4. You can export or import the rule and extension is “.xml”.

10. Proxy:
It will allow you to configure proxy settings for all requests. It will redirect all the requests to
proxy server.
Options are
1) No proxy
2) Obtain proxy settings from browser
3) Custom proxy

Hari Tech Page 57


Hari Hari Tech

11. Preferences:

1. Enable image and text check:


This option has to be enabled for web_find(), and web_image_check().
2. Wininet replay instead of socket:
For NTLM based applications or SSL based applications, you can use wininet replay.
If you don’t want to use web_set_socket option, then use wininet replay.
Options:
 HTTP request connection time out: A unit time within which request connection
operation should finish. Default is 120 seconds.
 HTTP request receive time out: A time unit within which receive operation should
finish. Default is 120 seconds.
 Step Download time out: A time unit within which entire step has to be finished.
Default is 120 seconds.

12. Download filters:


To exclude or include specific URL, use download filter option.
Q: How to design shared RTS? (or) How to configure RTS for multiple scripts?
A: Two ways we can configure the shared RTS
1. Vugen level: Configure RTS in one script, copy “.cfg” and “.usp” files and paste into
remaining script folders.
2. Controller level: Select all scripts and choose shared RTS and configure the same.
Note: Whenever script having vary number of actions and names, you should not create shared
RTS or should not copy “.cfg” and “.usp” files to some other scripts.

SLA configuration:
SLA configuration will allow you to compare derived statistics with expected statistics.
Step 1: Click on new under SLA
Step 2: Choose SLA measurement like total, average, throughput, hits per second, response time
and errors.
Step 3: Provide threshold point and click on finish.

Rendezvous test:
Rendezvous point is the point to instruct the users to wait at a certain location once the specified
number of users arrived at that point. It will execute the subsequent request.
Syntax:
lr_rendezvous(“xyz”);
Step 1: Write the function in the script.
Step 2: Go to controller and select rendezvous under scenario.
Step 3: Configure the policy by providing number of users and timeout.

Hari Tech Page 58


Hari Hari Tech

Pacing Calculations:
(or)
Little’s Law:
(or)
How to calculate TPH (Transactions per hour)?

Q : Target 1800 transactions per 1hr


1 Script contain 30 transactions
1 Iteration is taking 30 seconds
Calculate pacing?
A:
Step 1:
Calculate the total no of iterations = target transactions/script transactions
= 1800/30
= 60 (iterations)

Step 2:
Time for target iteration = Target iteration * 1 iteration time
= 60*30
= 1800 sec

Step 3:
Remaining Time = Target time‐ Target iteration time
= 3600‐1800
= 1800sec

Step 4:
Pacing = Reaming time/Target iterations
= 1800/60
= 30 sec

Hari Tech Page 59


Hari Hari Tech

Scenario 2:
Reverse Engineering:
Step 1:
Iteration time = Script time + Pacing
= 30+30
= 60 seconds/one iteration
Step 2:
Total Number of transactions = Number of iteration * one iteration time
= 60 * 60
= 3600

Q: Target 3000 transactions per 1hr


1 Script contain 60 transactions
1 Iteration is taking 10 seconds
No.of users 10 and duration 1 hr
Calculate pacing?
A:
Step 1:Calculate the total no.of iterations = target transactions/script transactions
= 3000/60
= 50 (iterations)

Step 2: 1 User Iteration =Total iterations/no.of Users


= 50/10=5

Step 3: Time for target iteration = (Target iteration‐1) * 1 iteration time


= (5‐1)*20
= 4*20
=80 sec

Step 4: Remaining Time = Target time‐ Target iteration time


=3600‐80
= 3520sec

Step 5: Pacing = Reaming time/Target iterations


= 3520/5
= 704 sec
Note: Whenever you are dealing minimal number of users and minimal number of transactions,
we have to reduce one iteration from target iteration.

Hari Tech Page 60


Hari Hari Tech

Formulae:
Pacing calculation P = R/I
P  Pacing
R  Remaining Time
I  Number of iterations

Remaining time R = D-(T*I)


D  Duration
T  Target transactions
I  Number of iterations

Number of iterations I = T/S


I  Number of iterations
T  Target transactions
S  Script transactions

Formulae 2:
Number of users = TP*(R+T)
TP  Throughput per second
R  Response time
T  Think time

Pacing P = R+T
R  Response time
T  Think time

Hari Tech Page 61


Hari Hari Tech

Q: How to add multiple load generators for single script?


Solution:
Select the group
 Click on vusers
 Add new LGs against vusers

Q: How to add multiple scripts against one group?


Solution:
Select the group
 Click on vusers
 Add new script for existing users or new users

Q: How to schedule a test to start at particular time?


Solution: Using start time option (under scenario schedule), we can schedule a test to run at
particular time.
Note: Click start button after scheduling.

Q: How to create multiple schedules in one “.lrs” file?


Solution: Using new schedule option, we can create multiple schedules for various kind of test.

Q: On what basis you are deciding how many LGs required for test?
Solution: Based on below parameters, you can decide how many LGs are required
1. Number of users
2. LG configuration
3. Script variables and size
4. Protocol type
5. Running vuser as a thread or process
Note: You have to conduct a memory footprint test and decide how many users can support by
LG.
Memory footprint test: Testing with single user or 20 users and 50 users conducting how many
users it can sustain called memory footprint test.
Current version of LR will send the notification whenever it reaches the threshold point.

Memory Foot Print in Load Generators:


The no of Load Generators depend on the below items.
1. Ram size of the Load Generator.
2. No of Variables & Memory allocation for variables in LR Script
3. How you are running vuser as a Process or a Thread.
If you are running vuser as a process
1 vuser process1 MDRV Engine5mb
If you are running vuser as a Thread
1 vuser (50) Thread1 MDRV Engine2mb

Hari Tech Page 62


Hari Hari Tech

Q: Is it possible to extend the test duration while running the test?


Solution: It is possible to extend the test duration using pause and resume schedule option.

Q: How to copy scheduler settings (ramp up, duration and ramp down) from one script to
another script?
Solution: Using copy scheduler options, we can copy the scheduler settings from one script to
multiple scripts.

Q: What is the process name (in task manager) for controller?


A: wlrun.exe

Q: When you are going to run agent as a process or service?


A: For all web based applications, run agent as a service.
For all client server applications or which applications are communicating with hardware of the
machine (NTLM or windows based applications), run agent as a process.

Q: How to run agent through command prompt?


A:
magentproc.exe  for process
magentservice.exe  for service

Q: How to invoke these manually?


A:
Start
 All programs
 HP Software
 HP Load Runner
 Advanced settings
 Agent process/service
Note: If you like to make it run as a service by default while installing LG software, you have to
choose the same option.

Q: My script is working fine in vugen but not in controller?


A:
Verify whether you are able to access the application from the LG
Verify LG runtime quota.
May be load balancing is not happening properly.

Hari Tech Page 63


Hari Hari Tech

Q: Who will provide the rampup, rampdown settings?


A: No one will suggest to use specific rampup and rampdown. As a performance tester, we have
to derive the rampup time based on below parameters
1) Application type (web/client server)
2) Type of load balancer
Note: Usually we will try to finish the rampup within 30-45 minutes if you are running test with
300-500 users.
Note: If it is a client side application, the rampup might be high.

Scenario 1:
In one of my application, we design the test by Ramping up user for one every 5 seconds.
But failed to execute this test due to the application crash?
Solution:
Application in working with minimal users but failing in full blown test. So we requested help
from architect people or developers and return the same test. They found problem is with load
balancer due to the rampup rate.
Whenever we are ramping up the users fastly, LG pushing all users into one instance which is
causing the failure. So they suggested to increase the rampup time.

Hari Tech Page 64


Hari Hari Tech

Common controller output messages:

No match found for the requested parameter


Issue: Connection issues
Solution: Fix the same

Connection to load generator fail or process lr_bridge.exe was not created on host machine
(or)
Communication error fail to connect to remote host or two way communication fail
Solution 1: Verify both machines whether those machines are on same network or not.
Solution 2: Verify both machines by pinging.
Solution 3: If there is a proxy server in between both of the machines, speak with IT admin
people to open the port number.
Solution 4: If there is a firewall in between both of the machines, speak with IT admin people to
install listeners in LGs under MI Listeners.

Files and users are not transferring to the LG


Causes:
 Script path is too long, reduce the path.
 Parameter naming convention might be a problem. Parameter naming convention
should not have any special characters.
 Script might be corrupted, fix the issue.
 Script naming convention should not contain any special characters.
 Parameter naming convention should match with“.dat” file naming convention in
“.prm” file
Solution:
Open “.prm” file, change the naming convention.

web_reg_find failed to find the text


Cause: Text verification failed.
Solution: Open the script, fix the issue.

Step download timed out error


Cause: Entire request is not finishing within 120 seconds or application is too slow
Solution: Increase the step download time limit (1000 or 2000)

User abnormally terminated by MDRV (Multi Driver) engine


Cause: User running as a thread instead of process
Solution: Change thread to process.

Hari Tech Page 65


Hari Hari Tech

Authentication failed 403 forbidden error.


Solution: Use web_set_user to submit the credentials to the web server.

Time out exceeded while waiting to receive data from the URL.
Cause: Network issue or application issue.
Solution: If network or application is very slow, increase the timeout limit.

Could not resolve address of host.


Cause: Failed to connect to application due to invalid URL or proxy server issue or SSL issue.
Solution: Resolve invalid URL or proxy server issue or SSL issues.

Customized error message.


Cause: Based on the requirement, you might have written lr_error_message(). to understand
where it is failing.
Solution: Open the application, fix the same.

HTTP 500 error.


Cause: Server busy or application busy or down
Solution: Open the application, fix the same.

Compilation error.
Cause: Syntax issue, code issue in the script.
Solution: Open the script and fix the same.

C interpreter error.
Cause: Runtime error which is caused by C code.
Solution: Fix the C code issue.

Memory violation exception error.


Cause 1: Generating some random values from an empty array.
Cause 2: Variable memory allocation issue.
Solution: Fix the same.

Hari Tech Page 66


Hari Hari Tech

Performance Center:

Performance center is a web based application, which is a web interface of controller. Using
PC we can design, execute, and download the results from anywhere any time. Using PC
you can manage your resources (controller, LG’s and no. of users) in perfect manner by looking
time slots.

Note: You have to buy PC license as well as Controller License.

Versions: 9.1/9.5 and 11.0 (Integrated with ALM)

Activities in Performance center:


 User level access.
 Project level access.
 Time slot bookings.
 Test design and Test execution.
 Upload &Download the scripts.
 Download the results anywhere Even you can monitor the servers by
integrating site scope or other tool.

Advantages:
1. It is a web based application.
2. You can monitor the resources in b/w your team members.

Process to connect to the PC:


 Launch the PC URL.
 Enter credentials.
 Choose your project.
 Push the scripts into controller.

Options or Tabs:
1. Status: Show show many test executions are currently running, upcoming schedule
test & how many recently ran (executed).

2. Host: Hosts hows how many LG’s, controllers, firewalls connected to thePC.

3. Timeslots: Hereyou can book the timeslots for your test by specifying duration, tests,
number of users and number of LGs.
Note: You have to book extra 15 min to import the Results.

Vusers scripts: Here you can upload, download, copy the scripts from other
project, and also duplicate, view & delete the scripts.

Hari Tech Page 67


Hari Hari Tech

There are two ways to upload the scripts:


1. Zip the script folder & upload to PC

2. Manual Procedure:
 Vugen.
 Tools.
 HP ALM (11.0).
 Connection (or) PC Connection (based on version).
 Provide the PC URL.
 Click connect button.
 Credentials of PC.

Monitoring Profiles: We can monitor the machines health by adding profiles.


Auto start viewer: It indicates the test schedule to start automatically as per the time frame.
Change project: To change the project this option.
Load Test:

Manage: New Load test


 Design
 RUN

General Tab: Load test name, TCP/IP ipspoofing options.


Scheduler: Same as controller design scenarios.
Design groups: Load generators.
We can download “.lrr” files after collating the results.

Performance Center Controller


1. Web based application 1. Standalone application
2. There is a time slot mechanism 2. No time slot mechanism
3. We can download/upload results anywhere 3. We can’t upload/download results until you
and anytime. get login.

Hari Tech Page 68


Hari Hari Tech

ALM (Application Life Cycle Management)

Lunch the ALM application using URL upload the scripts in to ALM by zipping or save as
option on my computer.
Navigate the test plan under testing,
Move the script test plan by creating a folder.
Click on edit test, to provide by number/ percentile, manual/ or goal, by group /or by schedule
Push script into scenario, provide RTS, ramp up, ramp down, duration, LG and load distribution.
Click on submit button.
Go to time slot, book a specific time or block a specific time by L.G by providing no. of users
date, start time and end time.
Note: you can manually specify the L.G’s or you can choose automatic option.
You can start the test automatically or manually.
Go to test results, choose your run id, download RAW- results or zip file.

Menu:
Dashboards
Managements
Requirements
Cloud settings
Testing
Resources
Defects
Performance center

Defect: When there is a deviation between the actual and expected, we have to raise a ticket
under defect tab by providing severity, priority, expect, actual results, attachments.

Testing host: It will allow you to verify how many LG’S and controllers are configure whether
those are operational are not operational and in which location or hosted.

Hari Tech Page 69


Hari Hari Tech

Types of testing

1. Warm up test/Dry-run test/Discovery test:


This is not the actual test but making ensure that all scripts, test data, environment and
application running fine and stable.
Note: Warm up test will conduct with 10% or 100% of actual load for short duration.

2. Performance test/Baseline test:


Whenever you don’t have SLAs, you have to conduct baseline test with single user, single script,
single iteration and execute the script in standalone mode and get the response times, consider as
a baseline response time.
Step 1: Choose schedule by group option
Step 2: Choose start scenario begin option to make scripts run one by one.
Note: Application should behave properly under the load how it was behaved with a single user.

3. Load Test:
Load testing is the testing to verify the application behavior under load.
We are designing the scenario with 100% load.
Refer graph below

4. Endurance Test/Soak Test/Longitivity Test:


Verifying whether application is available for longer duration or not.
We have to design endurance test with normal load (50-60% of peak load) for longer duration
(12h, 18h, 24h)
Note 1: Objective of this test is to identify the memory leakages.
Note 2: In some cases, we might require to design scenario with normal load by increasing think
time and pacing time.
Refer graph below

5. Stress Test:
Stress test is the test to identify the breaking point or performance degradation point of
application.
We can stress the application in two ways:
1. By increasing the number of users
2. By reducing the pacing and think time
Note: We can increase the number of transactions by reducing the pacing and think time without
adding the users.

Hari Tech Page 70


Hari Hari Tech

Q: I have license for 500 users but client asked me to test the scenario for 700 users.
Solution: To achieve the above objective, we reduce the pacing and think time to generate more
number of transactions. Usually we are designing the scenario with 1.25X, 1.5X, 1.75X, 2X, 3X,
4X, 5X loads.
In three ways, you can add the vusers.
1. Design the scenario and add the users manually for every time interval.
2. Design the scenario with more number of users using pause and resume scheduler, you can
add the users automatically.
3. Using real world scenario, you can add multiple actions for multiple rampups and durations.

6. Failover Test (based on client request):


In the absence of first data cord, verifying whether second data cord can take the load without
any failure transactions or performance degradation.
Process:
In one of my test, we designed a failover test for 2 hours duration. After one hour duration, we
reported to IT admin and architect people to unplug the first data cord from the network. We
verified whether test reported any failure transactions or performance degradations. Monitored
second data cord whether it is able to take entire load in the absence of first data cord.
In the above scenario, my role is very minimal. Plugging and unplugging performed by network
people.

7. Benchmark Test:
Benchmark test will give a repeatable set of quantifiable results which from current and future
releases. These results has to be compared with baseline test results.

8. Capacity Planning Test:


By forecasting the future usage, whatever the sequence of test we are conducting is called
capacity planning test.
Process:
We have to conduct load test, stress test to identify application breaking point. Speak with BA
people to understand what is the growth of the business and plan for capacity planning.
Refer graph below

9. Spike Test:
We have to test the application behavior under abnormal conditions.
Refer graph below

10. Volume Test:


Volume test is the test to verify the application behavior under huge amount of load.
Example: Interfaces and Batches

Hari Tech Page 71


Hari Hari Tech

11. Scalability Test:


Scalability Test is the testing of an application to measure its capacity. Scale up or scale down
using horizontal and vertical techniques.
We can scale down application in two ways:
1. Vertical scale down: Adding the resources to same node (CPU, memory,cores)
2. Horizontal scaling: We can add multiple nodes to existing system.

12. Network Latency/Wan Emulation Test:


To simulate the network latency (delay) we used HP Shunra (Network Virtualization) and
conducting virtualization test.

Q: If the controller crashes before collating the result, what is your approach to recover the
file?
Solution: If the controller crashes before collating the result, we can recover the result file.
Process:
 Go to load generator
 Select details
 Copy the path of the log
 Connect to LG through RDP
 Navigate to same path
 Copy “.eve” and “.log/.map” files
 Paste them into controller result path

Hari Tech Page 72


Hari Hari Tech

ANALYZER

Analyzer file Extension is “.lra”

1. Cross results option: Allow you to compare two “.lrr” files as part of benchmarking test.

2. Section explorer: Contains “.lrr” path, period, duration, average throughput hits per second,
total throughput, hits per second, transaction response time and status code.

3. Graphs: Allow you to add and delete the graphs.

4. Properties: Allow you to exclude/ include think time and generate percentage response time.

5. Controller output message: Controller error message will be displayed which will be help
full to analysis.

6. User data: Allow you to write something.

7. Raw data: Based on the request we can pull the raw data and send to architecture people to
analysis purpose.

8. Graph data: Will give raw data for graph.

9. Legend: To make you understand which color is indicating which measurement.


Scale: Indicating number of measurements in graph.

10. Granularity: Time difference b/w two saturation points.


NOTE: minimum Granularity for throughput and Hits per 5 second.
For all remaining graphs 1 second

11. 90th percentile:


90 percent of the transactions are completing with in this limit.
Step1: Write all the response times in ascending order.
Step2: Take out 10% of values from below.
Step3: Which will be the highest value consider as 90% response time.

Note1: We have to report only 90% response time to client.


Note 2: Based on client requirement we can generate 80%, 85%, 90% …etc.

Hari Tech Page 73


Hari Hari Tech

12. Reports:
By default we can generate doc report, Html report, crystal report, PDF report.
Reporting:
Once the test got completed, I will export the response times to excel and I will prepare a
comparison report.

Comparison report:
It compares 90th percentile response times with baseline response times of previous test results
and I will maintain a RAG (Red Amber Green) status.
In some other tab, I will copy merged graph to understand the test results.
Apart from comparison report, we will prepare a quick analysis summary which contains
objective, scope, how we designed the scenario, test environment, observations in terms of
resource utilization, high response times and controller, web server logs.
I will send a mail to get AWR, NMON reports for future analysis.
I will prepare a PPT by analyzing all the supporting files (AWR, NMON …) by mentioning
objective, observations, environment comparison, high response transactions, root causes to
present to the stake holder.

Q: How to generate the reports?


A:
 Choose reports
 Navigate to report template
 Click on generate report
 Save on required format.

Q: How to create a template?


A:
 Tools
Navigate to templates
Create new template
 Click on save and close button.

Q: How to add existing template to current session?


A:
 Open “.lra” file
 Go to tools
 Choose templates
 Select specific template
Apply to session.

Analysis Process:

Hari Tech Page 74


Hari Hari Tech

Q: What is your approach to analyze the statistics?


(or)
What is the process you are following to identify the bottleneck?
A:
Once the test got finished, I am going to compare derived statistics with expected statistics. If
both are not comparable, then I will start the process to find out the root cause.

 Client side statistics analysis (analyzer, throughput, Hits per second, Response time).
 Server side statistics analysis (Hardware and OS level statistics).
 Application side statistics (Methods, I/O operations, DB, EJB, Packages etc..).
 Configuration setting analysis (Current limit, Connection limit, Thread limits..etc..).

1. Client side statistics analysis:


 Running Vusers.
 Connections.
 Hits per seconds.
 Throughput.
 Error per second.
 Response time.

Merging: We can merge the graph in 3 ways.


Overlay Graph
Tile graph
Correlate graph
1. Overlay graph:
It plots a graph with two Y-axis by sharing one X-axis.

Hari Tech Page 75


Hari Hari Tech

Overlay graph:

Hari Tech Page 76


Hari Hari Tech

2. Tile Graph:
View the contents of two charts that shares a common X-axis one-above the others.
Ex: Hits per second and throughput

3. Collate Graph:
Plot two Y-axis of two charts against each other’s.

Hari Tech Page 77


Hari Hari Tech

Scenario1:
Relation between Hits per second and throughput.
 Both should be directlyproportional, if not
Cause1: That could be a network bandwidth issue.
Cause2: Web server might have issue.
Cause3: Application itself having the issue.
Note: Hits are increasing and throughputs are not increasing due to the application issues. We
are receiving exception page which impacts high hits low throughput.

Scenario2:
Relation between running users and hits per second?
 Both should be directly propositional, if not application itself having a problem (or)
application is not responding well.

Scenario3:
Relation between throughput and response time.
 Both should be inversely proportional.
Note: As per the market standard both should be inversely proportional based on boundaries (if
you are testing pages).

Scenario4:
Relation between running users and connections
 Both should be directly proportional, if not
Cause1: Connection limit issues in the web server.
Cause2: Number of treads limit reached threshold point in the web server.
Controller output message for above issue:
1. Users permanently or prematurely shutdown
2. Web server log max client error.

Hari Tech Page 78


Hari Hari Tech

WEB PAGE DIAGNOSTICS:


Using Web page diagnostics graph we drill down the issues related to component, network, and
server level issues (break down drill).

Component Break down graph:


Which will allow you to analyze component level issue any one of the component getting delay
to download which will reported as an issue.

Time Taken For First Buffer Graph (TTFB):


If the TTFB is high then the problem is with server or application.
If the TTFB is low and the page response time is very high then that is a network issue.

Q: What is the difference between absolute graph and relative graph?


A: Absolute graph plots the graph based on the system time. Relative graph plots the graph based
on elapsed time.

Server side Statistics analysis:


Monitoring CPU, Memory, and Disk Utilizations is called server side analysis.
Note: For all windows OS based machines CPU, memory utilization should not cross 80%. For
all UNIX, Linux, Red hat OS based machines should not cross 90%.

Q: Difference between the simultaneous users and concurrent users?


A: Whoever connect to the application (or) whoever keeping the load against the application
those users consider as concurrent users.
Whoever performing the same transaction in same time those users will be consider as
simultaneous users.
Note: concurrent users always greater than (>) simultaneous user. To conduct the test with the
simultaneous user we have to design rendezvous test.

Hari Tech Page 79


Hari Hari Tech

Thread Dump:
Whenever application is not performing well, we used to analyze thread dump.
Thread Dump is a snapshot of thread status.
There are two types of threads:
1. Demon Threads: Which are invoked by OS and hardware level
2. Non Demon Threads: Which are created by program.
Example: public static void main (string args [])

Thread Status:

New
Blocked

Waiting
Runnable

Timed waiting

Terminated

Thread contention:
Thread contention is a status in which one thread is waiting for a lock which is locked by some
other thread.

Deadlock:
Deadlock is a situation where one or more threads are waiting for other resources which are
locked by some other threads.

Thread synchronization:
This code will allow the threads to use multiple resources by multiple threads.
In Java, every object has one monitor. At any point of time, only one thread get lock on monitor.
Other threads will wait until monitor will be released.

Note: Thread dumps will be published with the help of jstack or jvisualvm.
As part of analysis, we are going to identify which threads are in blocked status and waiting
status.
If you find any blocked threads, verify for which stack it is looking for, who locked on expected
stack, copy these details and post to developer.
If you find waiting threads, we have to find which methods are executing for particular thread
(wait (), park (), sleep ()) and copy details and post to developer.

Hari Tech Page 80


Hari Hari Tech

If multiple threads are trying to get locks on stacks which is locked by some other threads causes
deadlock threads. Apart from above analysis, we do have internal thread analyzer tools.
Using these tools, we are deducting the deadlocks and thread level issues. For infrastructure
level, we have to take CPU sampling, which thread is utilizing more CPU and report the same.

Memory Dump:
Memory dump is a snapshot of memory utilization statistics in a particular time period.
Whenever you received OOM (Out of memory) exception or memory leakages we have to take
the memory dump to find out the root cause.
We do have two types of memories
1. Stack memory: Static variables will be loaded into stack memory
2. Heap memory: Dynamic variables will be loaded into heap memory.
Memory dump contains below information:
 Objects
 Classes
 Class Names
 Class loader information
 Fields
 Primitive fields
 Garbage collection roots
 Thread level data
 Stacks

To understand the memory dump, we should drill down how many threads required for our
application, how much memory required by each and every thread will give detailed idea about
memory footprint (static)
Memory dump will give static memory and dynamic memory information (user session) for
analysis purpose.
Using memory dump, we can identify which object, class are running for more time, we can
copy them and send to the developer.
If you are not able to analyze the memory dump manually, we can use memory dump analyzer
tools to identify the issue.
Memory dump extension is “.phd” or “.hprof”

Hari Tech Page 81


Hari Hari Tech

Difference between Load Runner versions:

Load runner versions Changes


1. LR 9.0 – LR 9.5  Protocol advisor
 RDP and RTE protocol
enhancement
 Correlation Studio enhanced with
new rule
2. LR 9.5 – LR 11.0  AJAX truclient introduced
 Result export option in analyzer
 Mobile protocol introduced
 web_reg_save_paramex() introduced
3. LR 11.0 – LR 11.5  AJAX truclient protocol started
working in IE
 Entire user interface of vugen got
changed
 Network virtualization and service
virtualization introduced.
 Solution explorer introduced.
 LR developed in sharp IDE
4. LR 11.5- LR 12.01  Mobility protocol enhanced
 SAP mobile protocol introduced
 LR became lightweight application
5. LR 12.01- LR 12.5  Customized protocol introduced
where you can create your own
protocol
 Junkin plugins are introduced

Hari Tech Page 82


Hari Hari Tech

Profiling Tools:

1. JConsole:
JConsole is a default profiling tool for JVM. To leverage the services we have to install JDK.
Here We can only view Hardware Statistics such as CPU, memory, threads, classes
By default we can view CPU, memory, threads, classes as part of garphs.

Steps to invoke JConsole:


 My Computer
 Program Files
 Java
 bin
 JConsole

Overview Of JConsole:

Hari Tech Page 83


Hari Hari Tech

2. JVisualVM:
JVisualVM is a default profiling tool for JVM. To leverage the services we have to install JDK.

Steps to invoke JVisualVM:


 My Computer
 Program Files
 Java
 bin
 JVisualVM
We can Monitor
1. Local Machine
2. Remote Machine

Steps to invoke Remote Machine:


 Go to Remote tab
 Add ProcessID
 Add JMX connections by providing Port Numbers

1. Overview:
Here we can view how much memory?, XMS & XMX settins, JVM version, JRE Version
Here we can check JVM Arguments & System Properties

2. Monitor:
By default we can View CPU,Memory,Classes,threds graphs
Here we can perform GC and we take heap dump
Heap dump extension is “.hprof”
Here we can check memory leakge with the help of heap metaspace graph.

3. Threads:
Here we can view thread status like Running(), Sleep(), Park(), Waiting()
And we can take thread dump for Analysis Purpose.
Note 1: For thread dump analysis copy the thread dump and paste it in any online thread
analyzer tool.
Note 2: We can’t copy Thread dump from remote machine to local machine and vice versa.

4. Sampler:
Here we can view how much CPU & Memory Utilized by each & every thread as part of
JVisualVM.

Hari Tech Page 84


Hari Hari Tech

Overview Of JVisualVM:

3. JMC(Java Mission Control):


JMC is a upgareded version of JVisualVM. Its has more Graphical User Interface(GUI).
Bydeafult we can view JVM CPU usage, used java heap maemory, total live thread count, used
physical memory as part of GUI
Also we can view processor & memory as part of graphs.
Here also we can analyze thread and memory status same as JVisualVM.

Steps to invoke JMC:


 My Computer
 Program Files
 Java
 bin
 JMC

Hari Tech Page 85


Hari Hari Tech

Overview Of JMC:

Hari Tech Page 86


Hari Hari Tech

Monitoring Tools
1. Site scope:
 It is an agent less monitoring tool or online monitoring tool.
 It is a server monitoring tool, to monitor any kind of servers.
 At a time, we can monitor 120 servers.
 We have to configure the web, app and DB to site scope.
 We can monitor for every time interval at any point of time from anywhere in the world.
 By using this, we can monitor windows, UNIX and ax-box.
 We need to install the site scope in your machine.
 We need to configure server in site scope.
 We can add monitoring profiler in site scope.
 It is a product of HP, and latest version is 11.52.

Launch the site scope URL and provide credentials after that we are able to see the following
tabs
 Monitor – Here we can add counter to monitor which server you want.
 Remote Server – In this, we can configure win, UNIX servers.
 Templates
 Preference
 Server statistic
 Tools

Configuring server in site scope


1. Go to Remote server tab – select windows or Unix
2. For windows, provide the following details
 Name
 Description
 Server IP or Server Name
 Provide credentials. i.e, username & password
 Method – WMI ( web method invocation)
 Click on save

3. For UNIX provide the following details.


 Name
 Description
 Server IP or server name.
 Provide credentials i.e. username and password.
 Provide OS.
 Method –SSH (secure socket host)
 Click on save
In monitor tab we can do add counter, quick reports, current status and history.

Hari Tech Page 87


Hari Hari Tech

Adding servers:
 Open Site Scope
 Monitor
 Remote servers
 UNIX remote systems

2. Dynatrace:
Step1: Login to dynaTrace server via dynaTrace client 5.5 installed on your desktop using your
NTID and password.

First open the dynaTrace client 5.5 and click on “Settings” dynaTrace Server as shown below

Step 2: You will get a new window where you are asked to enter the server details and your
credentials.

Hari Tech Page 88


Hari Hari Tech

Click on “Test connection”. Once the connection is established click on click on “Apply” and
then “OK”

There are 2 dynaTrace servers configured for TPT environment and they are b0185-app0246-s
and b0185-app0247-s, so ensure that you login to the server where your project profile has been
created.

The below table contains the server and the system profile of Emerging Business applications.

Sl no Application Dynatrace server System Profile


1 Interlink Not Applicable Not Applicable
2 Encompass B0185-app0247-s XH_EncDashBoard
3 Northlight B0185-app0246-s DR-Northlight
4 Drivewise B0185-app0246-s F9DRVWISE-8-TPT
5 NQ2/MyAccount/Allstate.com B0185-app0246-s IMT

Once you launch dynatrace, you can select the system profile on which you wish to
work/monitor.

Each profile has servers configured for monitoring. IMT profile has 4 servers (2 web and 2 app
servers) configured. Here we can monitor the infrastructure and the applications alternately by
selecting the desired one. In infrastructure we can monitor the servers performance, the CPU &
Memory utilized etc.

You can also select any specific server and view further details like the applications running on
each of these servers, the OS and its version running on the server, number of CPU cores, IP
Address of the server, number of applications processes running and also their type.

Hari Tech Page 89


Hari Hari Tech

You can further select any application running on the server. Here you can see application
process specific details like process id associated with this process, Garbage Collection occurred
at various generation levels, Suspension time caused due to Garbage Collection, CPU Used by
this application process and also thread count.

To monitor the application i.e. the exceptions thrown during the test, errors generated,
webservices being called, webrequests, response times, graphs for CPU consumption at the
process level, we have to create a new “Dashboard”. In the menu bar, click on Dashboard New
to create a new Dashboard.

Hari Tech Page 90


Hari Hari Tech

In the next screen select either of “Use for Analysis” or “Use for Monitoring” as per
requirement.

Hari Tech Page 91


Hari Hari Tech

After this you will be asked to select a “Dashlet” for your dashboard. Initially you can select any
of the dashlet among the various options. Later you can add new dashlets, delete existing
dashlets.

In the dashlet, details specific to the dashlet for the last 30 minutes will be present. You can
further alter the time duration for which you want view data. You can also select a past date/time
during which a test would have executed a week ago.

Please Note: Since the dynatrace client is configured on your local desktop, the client would
consider your local desktop time for fetching any details stored on the dynatrace server. So, if a
test is executed during EDT time(assume a test was executed during 23/07/2014 13:28:49 -
23/07/2014 14:55:01 EDT) and your desktop is configured in IST time zone, then to fetch the

Hari Tech Page 92


Hari Hari Tech

details of the test, you must convert the test execution time in EDT to IST(23/07/2014 10:58:49
PM - 24/07/2014 12:25:01 AM IST) before fetching the sessions.

You can also fetch details specific to a particular transaction by entering the purepath name for
the specific transaction.

Further filtering of data can be done specific to a particular application etc.

It is possible to drill further down from a purepath to an exception thrown when the pure path is
executed, or from an exception to the webservice that throws the exception, or the webrequests

Hari Tech Page 93


Hari Hari Tech

executed for a particular transaction. Just right click on the


exception/purepath/webservice/webrequest and drill down as shown below.

Also, when you select a purepath, a purepath tree in the window below shows the flow of the
purepath, the requests executed, the DB calls, webservices request and response details along
with the time consumed for each of these actions to execute.

Hari Tech Page 94


Hari Hari Tech

It is also possible to generate graphs for various system resources consumption during the test.

You have to use the “Charting” dashlet to generate graphs.

Please read the below section on how to save/store the dynatrace sessions for a particular
duration at a shared location.

Hari Tech Page 95


Hari Hari Tech

Every project that has been configured on dynaTrace has a unique profile name.

Select the profile name for which you want to export the session. The profile name can be found
under “System Profiles”. For Encompass Dashboard, the profile name is XH_EncDashboard.

Hari Tech Page 96


Hari Hari Tech

When you expand the Profile, you can see various tabs as shown below.

You can go to any of the desired tab to see the corresponding details.

When you are exporting the session, you have to right- click on the profile, and select “Session
storage”  “Export Session”.

Hari Tech Page 97


Hari Hari Tech

Once you select “Export Session” you get a new window as shown below where you are asked to
enter the file path where the session has to be stored. The file will be stored with “.dts”
extension.

Also, enter the duration of the test execution to store the session under Timeframe.

Hari Tech Page 98


Hari Hari Tech

Note: The duration of the test executed in controller is in CST timezone and if you are exporting
the dynaTrace session and the time zone of your machine is not in CST, then convert the
corresponding CST time to your local time zone and then export the session(because the client is
configured to your local time zone).

Under “Content” select “PurePaths and time series” or anything as per your requirement and
finally click on “Export”.

Hari Tech Page 99


Hari Hari Tech

3. HP Shunra:
HP Shunra is created by Shunra, acquired by HP.

Before 11.0, we used to call it as WAN Emulator.

After 11.0 onwards, we used to call it as Network Virtualization.

Steps:

 Install Shunra in Controller.


 Install Shunra agent in Load Generator.

Prerequisites: We have to create “.ntx” file based on the locations.

Steps to browse .ntx files:

 Open the controller


 Design the scenario
 Go to LG
 Click on details
 Choose network virtualization option
 Choose professional option
 Browse .ntx files

Once the test is finished, filter the response times based on the response times and report the
same.

Steps to use Shunra in controller:

 Design the scenario in controller


 Click on network virtualization/location virtualization
 Choose per group
 Create profiles by configuring the .ntx files
 Assign the profile against every script
 Conduct the test

Open .lra file, filter the response times based on host names and report the same.

Hari Tech Page 100


Hari Hari Tech

4. Perfmon:
It is a default monitoring tool to monitor windows operating systems based servers.
 Start
 RUN
 Type Perfmon
 Click ok.
Process:
 Right click on counter logs
 New log settings
 Provide the output file name
 Add servers& objects along with counters
 Define time interval
 Provide the output file name and Schedule settings.

CVS/VSS (Concurrent Versioning System/Visual Source Safe)


All these tools supports change management system. It facilitate end users to work on current
version of file.
Step 1: Once you create a file, you have to check in to CVS.
Step 2: Your teammate will checkout same file into his local machine and implement to changes.
Step 3: He has to check in modified file into CVS.
Note: At any point of time, only one person can work on current version of file.

Hari Tech Page 101


Hari Hari Tech

Bottlenecks

Bottleneck is an issue which causes delays Response Time.


We have to find bottlenecks in below areas:
1. Network
2. Hardware
3. Code/Application
4. Configuration Settings

1. OACore issue: Oacore process the requests and consumes the memory from JVM heap.
Scenario 1: I have an application called oracle R12/oracle apps/Ebiz which has to support 300
users, expected response times are below 5 seconds. While ramping up the users, application
performance is degraded at 100 user load. Even application itself crashed at 150 user load.

Process: Initially we started analyzing client side statistics and found that issue with server side.
Then we analyzed OS/hardware/code/DB but we did not find anything. So moved to DB layer,
finally we found an issue with JVM settings which is a oacore settings (memory management
configuration).
After analyzing oacore settings, we recommended them to tweak that setting from oacore = 1 to
oacore = 3 which resolved the issue.

2. Cursor Limit Issue:


We have an application which has to support 500 users
Solution: We started test with 500 users but application got crashed at 150 user load and
application performance degraded at 100 user load.
We have started analyzing client side, OS, hardware, memory, method, level statistics which
didn’t provide any clue. Then we started analyzing configuration settings in HTTPD file in
Tomcat Apache server and database statistics. Then moved to database configuration settings.
We found an issue with cursor limit which is causing application crash.
Process: We used dynatrace profiling tool to monitor all the layers of application including
configuration settings as part of testing while ramping up users, cursor limit usage reported
100% at 120 user load. Then we asked DB team to provide the cursor limit setting which is
reported 50. By default cursor limit is 50 which can accommodate only 100 users. We
recommended them to change 50 to 2000 as per oracle SGA, they can tweak to 1000 for that
application.
After deploying new build with 1000 cursor limit supported 500 users without any performance
degradation.

Hari Tech Page 102


Hari Hari Tech

3. Dead locks:
Dead lock is a situation which causes longer wait or makes transaction failure.
Ex: if the user A locked on Table 1 requested lock on Table 2, which is locked by user B. Both
are not willing to release the locks which will cause failure transaction.
With the help of DBA we can find Dead locks.
Dead locks occur due to DB poor design.Oratrace can be used to find Dead locks in AWR
Reports.

User A Table
1

User B Table
2

4. To find out the best server for the application


Client asked me to find out which is the best server for their application
Objective: Maxout the resources in both of the servers to find out which is best for their
application. We need to find out at what user load, at what hits per second and at what level of
throughput servers are maxingout the resources.
Process: Initially we deployed the application in both the servers and conducted test
independently with multiple users, we received max client error without reaching objective. Then
we received error at controller “Server has shut down the connection prematurely”. Then we
suggested install JVM to monitor at server level.
Again we conducted one more test with the help of JVisualVM monitoring support we found
error message in the logs which is related to configuration settings.
Server is within minsparethread of maxclient consider raising the maxclient settings.
From the above observation, we found issue with configuration settings, asked them to provide
Apache configuration settings.
After tweak the above settings for multiple times, we achieved objective of the test.
Conclusion: We reached the performance degradation point at 1500 user load for web logic
server and 2000 user load for Tomcat Apache.
We recommended client Tomcat Apache is the best server for their application.

5. Memory leakage:
It is a concept deals with memory management to execute any program or task we require
Memory.
Memory has to be de‐allocated from unused variables or un‐referencive variables by GC
Engine.
If the memory is not de‐allocating from un‐referncive variables causes memory leakage.
To find out memory leakage issue we have to conduct availability test.

Hari Tech Page 103


Hari Hari Tech

GC Engine:
It is a mechanism automatically loads in to the system and de‐allocates memory from un‐
returncive objects.
Note 1: How often GC Engine is loading in to the system.
Note 2: How long it is taking de allocating memory from the un‐referencive objects.

Heap Graph When There is a Memory Leak


10
8
6
Heap Memory

4
2
0
0 1 2 3 4 5 6 7
Elapsed Time

Heap Graph When There is No Memory Leak


4

3
Heap Memory

0
0 1 2 4 4 5 6 7
Elapsed Time

Heap graph should be in teeth pattern, and it should not be an upper trend graph.

We have various types of memory pools.


1. Heap memory
2. Non‐Heap memory

Hari Tech Page 104


Hari Hari Tech

Heap memory is having multiple memory pools

Heap Memory Non Heap


Memory
(Objects & Classes)

Older Younger
Generation Generation

(Long Live (Short Live Objects)


Objects)

2 Eden 1 Survivor
Pools

Garbage Collector Mechanism:


Garbage Collector is a method which will invoke automatically based on XML settings.
GC loads as
Half GC: Deallocates memory from younger generation
Full GC: Deallocates memory from both generations.

6. Thread limit:
We found an issue server reached the max number of simultaneous connections in server log.
Cause: Not enough threads in Apache.
Statistics: Due to the connection pool settings, application is not able to handle simultaneous
connections created by 150 users.
Recommendations: Increase the connection pool settings from 10 to 16.

7. Heap memory issue in Tomcat:


In one of my business object application, we received an error “web intelligence is busy contact
BO admin”.
Cause: High CPU utilization triggered by JVM process.
Recommendation: Upgrade the heap memory in template.

Hari Tech Page 105


Hari Hari Tech

8. Database error occurred:


Database error received like “unable to bind configuration objects” and “unable to extend temp
segment by 128 in table space temp_BO”.
Cause 1: Oracle SGI architecture
Cause 2: Java version
Recommendation: We received the oracle patch and applied the same even though we found an
issue with oracle JDBC protocol violation.
AD team pull the logs and shared with oracle team received the new patch and used new ODBC
jar file to check whether java 6 is backward compatible or not.

9. High CPU utilization due to I/O operation:


Process: My application reported high CPU utilization as part of drill down, we segregate the
CPU utilization into messing level and user level.
User level CPU utilization reported very high again we drilled down into I/O operations, method,
EJB(Enterprise Java Bean), package level.
Cause: We found that one of the I/O utilizing more CPU.
Recommendation: We recommended AD people to verify whether really that I/O operation is
required and when it is utilizing more CPU.

10. Private Byte Issue:


Process: In one of my SAP application, users are causing memory dumps as per SAP
architecture, they configured private bytes 4mb memory. If the users are trying to retrieve more
than 4mb memory, then the users will be pushed to run mode to debug mode. If SAP system
allocates more memory, then the user will come back to run mode. To execute the report if the
system is not allocating the memory, the users will be pushed to error mode which causes the
memory dump.
Recommendation: Recommended SAP people to reconfigure private byte settings.

11. High CPU utilization:


To perform any action, we required processor time. If the processor is not available (100%
utilized) to perform the task, it causes the application failure or impacts the transaction response
time.
Recommendation: Upgrade the processor.
Counters:
1. Ideal CPU
2. System CPU
3. User CPU
4. Privileged Time
5. Processor CPU
6. CPU interrupts
7. Consumption of operation
8. Kernel mode CPU logs

Hari Tech Page 106


Hari Hari Tech

Note
By default, every thread privileged CPU time will be allocated.

12. High Memory Utilization:


To perform any action, we required memory. High memory utilization impacts the application
performance and transaction response time.
Recommendation: Upgrade the memory.

Counters:
1. Available Memory
2. Committed Bytes
3. Cached Bytes
4. Page faults per second
5. Page reads per second
6. Page writes per second

13. OOM (Out of memory) Exception:


In one of my application, we received OOM exception.
Process: As part of analysis, memory utilization reported 50% still causing OOM exception
Cause: Server is running on 8 GB ram with 32bit OS
Recommendation: We recommended them to upgrade the server from 32bit to 64bit to resolve
the issue.
Note: 32 bit supports only 4 GBRAM
64 bit supports upto 1TBRAM

14. High physical disk queue length:


Disk queue length should be minimal.
In one of my application, we found high disk queue length which is causing high response times.
Physical disk queue length should not cross twice of the spindles.
Counters:
1. Disk read time
2. Disk write time
3. Average Disk bytes (Read and Write)

15. Processor queue length:


It should be minimal.
Verification: It should not cross twice of the cores.

Hari Tech Page 107


Hari Hari Tech

Database bottlenecks:

1. Low buffer hit ratio:


Process: Generated AWR report and found low buffer hit ratio which is reported 60%. BHR
should be more than 95%.
Cause: Due to allocation of low memory to the buffer memory, triggers low BHR.
Recommendation: Recommended DB architect people to increase buffer memory allocation by
redesigning oracle SGA.

2. Low index utilization


Low index utilization can’t monitor by AWR. With the help of DBA, we found index utilization
issues and asked them to provide tuning opportunities in terms of index utilization.
Cause: Low index utilization causes delayed response time.
Recommendation: Redesign the index.

3. Full table scans


With the help of DBA, we found there are lot of full table scans.
Cause: Full table scan causes delayed response time.
Recommendation: Redesign the index and implement the index of which tables are frequently
accessed.

4. High hard parses and soft parses


Cause: AWR reported high monitor and CPU parsing time which indicates that there are lot of
hard parses happening.
Process: Whenever we fire a request, query tried to retrieve the information from buffered
memory. If the data is not available in buffered memory, then it has to retrieve from the tables.
To retrieve the data, it has to load as hard parsing or soft parsing.
Hard parsing:
 Loading into shared pool
 Syntax verification
 Verify the table authorization
 Transformation of sql queries from complex to simple
 Preparing execution plan
 Executing the sql query
 Fetch data from table
Soft parsing:
Except step 1, it will perform all above steps.
Recommendation:
1) Alter the shared memory pool size.
2) Verify the binding variables in query.

Hari Tech Page 108


Hari Hari Tech

5. High I/O operation queries


Drill down
Why queries are utilizing more CPU for any I/O operation?
How much CPU utilized by the I/O operation?
Recommendation: Recommended fine tune the queries of I/O operations.

6. High Elapsed running queries


Cause: AWR reported high elapsed running queries which causes the delayed response time.
Process: We gone through the queries which contains lot of binding variables, inner queries
which causes the delayed response time.
Recommendation: Recommended DB people to rewrite the query and tuning the inner queries
and binding variables.

7. High CPU utilized queries


Cause: AWR reported high CPU utilized queries which causes the delayed response time.
Process: Once we gone through the AWR report which contains more number of high CPU
utilized queries, we segregated that into DB level and machine level.
Recommendation: Recommended DB people to tune the query which causes high CPU
utilization.

8. DB time and DB CPU time


Cause: AWR reported high DB time and DB CPU time which causes the delayed response time.
It should be minimal.
Recommendation: Recommended DB people to redesign the DB architecture.

Hari Tech Page 109


Hari Hari Tech

COUNTERS

1. JVM COUNTERS:
Process CPU Time:
Indicating the total amount of CPU time consumed by JVM.
Garbage Collector time (Garbage Collection Time):
Indicates the cumulative time spent on garbage collection and total number of innovations
(invokes).
Current Heap Size:
Indicates the no of kilobytes (Kb) occupied by objects.
Free memory:
Available memory in the heap.
Garbage collector interval Time: time difference between garbage collection cause.

2. CLR (Common Library Runtime) Counters:


 Exception through per second: Indicating number of managed code exceptions
thrown per second.
 Timing GC: Time spent on garbage collection.
 .net CLR memory heap size:
 .net CLR total committed bytes
 .net CLR large object heap size

3. WEB SERVER COUNTERS:


Apache:
 CPU load: Percentage of the CPU consumed by apache server.
 Request per second: The total number of request per second served by apache.
 Bytes per second(throughput)
 Busy workers: Number of active threads serving the request.
 Ideal workers: Number of inactive threads in the apache.

IIS SERVER (INTERNET INFORMATION SERVICES):


NOTE: IIS is a web app server for .Net based application.
 Bytes sent per second.
 Bytes received for second.
 Current connections.
 Request per second disconnection ratio.
 Number of request queued.
 Number of requests rejected.
Anonymous Users:
Indicating anonymous http connections in the particular tab.

Hari Tech Page 110


Hari Hari Tech

4. APPLICATION SERVER COUNTERS:


Web logic server:
 Execute the thread total count: Indicating the total number of threads assigned to
queue.
 Pending request current count: Indicates number of pending request in queue
 Queue length: Number of request in the priority queue.
 Throughput: number bytes received per second.
 Exception count: It should not cross 20.
 Connections current count:
 Transactions roll back total counts: it should not cross 5.

WEBSPHERE (IBM WAS) COUNTERS:


 Concurrent request: Number of requests are concurrently processed.
 Service time: Response time for a servlet request.
 Active count: Number of active threads in the system.
 Connection pool size: Number of threads in the pool.

5. Network Counters:
 Connection established: indicating connections success ratio.
 Connections failure: Percentage of connections failure.
 Through put:
 Network latency (delay):
 Pocket loss:

6. Disk Counters:
Disk read per second:
Disk writes per second: rate of write operations on the disk.
Average disk queue length: Number of read and write request that were queued for selected
disk during the sample interval.
Disk time: percentage of the elapsed time that the selected disk was busy with serving read and
write request.
Note:
Average disk queue length should not cross to for every disk.
Split I/O‘s Second: Measures the rate of I/O split due to file fragmentation.
Free space: Display the percentage of total available space.

7. Database Counters:
 We can monitor oracle 10g versions using DB stats reports above 10g.
 AWR reports.
Note:
Even DBA can generates the DB trace (or) oracle trace report to identify dead locks and full
table scan.

Hari Tech Page 111


Hari Hari Tech

Oracle counters (for all java based applications):


 Buffer hit ratio
 Full table scan
 Indexing
 DB time
 DB CPU time
 Hard parses and soft parses
 Top 5 time taken events(in a particular durations)
 Physical read
 Physical writes
 High CPU utilized query’s
 High memory utilized query’s
 High I/O’s utilized query’s

SQL Server Counters (.NET based applications):


Using sql profile we can monitor DB activities.
Navigations:
 Open SQL server
 Choose new option
 Choose create new profile.

Counters:
Buffer cached hit ratio.
Transactions for second.
Log cached hit ratio.
Page read per second.
Page writes per second.

SAP HANA Counters:


Using SAP HANA studio we can monitor SAP HANA.
SAP HANA built on column and row based technology.
But purely work on column based.

Hari Tech Page 112


Hari Hari Tech

Protocols
1. SAP Web Protocol:
SAP web protocol same like as Web HTTP/HTML protocol. If the application is developed as a
ECC portal, net weaver portal, dynapro portal. We have to use SAP Web protocol. If the LR
failed to record the objects using Web HTTP/HTML then only we can use SAP protocol.

The SAP-Web Vuser script typically contains several SAP transactions which make up a
business process. The business process consists of functions that emulate user actions. For
information about these functions, see the Web functions in the Function Reference.

Note: You can generate a SAP - Web Vuser script by analyzing an existing network traffic file
(capture file). This method may be useful for creating Vuser scripts that emulate activity on
mobile applications.

Common correlation values in SAP Protocol:

1. SAP_exit_sid
2. SAP_context_id
3. SAP_securid
4. Window_id
5. Event queue [WD1101]

How to handle window Id?

Window id is a 13 digit time stamp which will generates in millisec.

Ex: windowed=144333121987

Challenges (or) Scripting Technique:

In one of the ECC portal SAP_exit_sid capturing as ABCD11234566789PLNNO.

Whenever I am trying to convert the above value HTML to URL, URL to HTML. Which
is not happening properly.

To overcome the above scenario. I have to search for a character in the captured value,
replace with expected character.

To find and replace a character, we written the “C” code which will automatically search
for string and replaces with other string. Once it replaced we are converting to the Lr variable &
substituting whenever we required.

The following example shows a typical recording for an SAP Portal client:

Hari Tech Page 113


Hari Hari Tech

Example:
vuser_init()
{
web_reg_find("Text=SAP Portals Enterprise Portal 5.0",
LAST);
web_set_user("junior{UserNumber}",
lr_decrypt("3ed4cfe457afe04e"),
"sonata.hplab.com:80");
web_url("sapportal",
"URL=http://sonata.hplab.com/sapportal",
"Resource=0",
"RecContentType=text/html",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES,
"Url=/SAPPortal/IE/Media/sap_mango_polarwind/images/header/branding_image.jpg",

"Referer=http://sonata.hplab.com/hrnp$30001/sonata.hplab.coml:80/Action/26011[header]"
, ENDITEM,
"Url=/SAPPortal/IE/Media/sap_mango_polarwind/images/header/logo.gif",

"Referer=http://sonata.hplab.com/hrnp$30001/sonata.hplab.com:80/Action/26011[header]",
ENDITEM,
...
LAST);
The following section illustrates an SAP Web and SAP GUI multi-protocol recording in which
the Portal client opens an SAP control. Note the switch from web_xxx to sapgui_xxx functions.

Example:
web_url("dummy",
"URL=http://sonata.hplab.com:1000/hrnp$30000/sonata.hplab.com:
1000/Action/dummy?PASS_PARAMS=YES=;dummyComp=dummy=;
Tcode=VA01=;draggable=0=;CompFName=VA01=;Style=sap_mango_polarwind",
"Resource=0",
"RecContentType=text/html",
"Referer=http://sonata.hplab.com/sapportal",
"Snapshot=t9.inf",
"Mode=HTML",
LAST);
sapgui_open_connection_ex(" /H/Protector/S/3200 /WP",
"",

Hari Tech Page 114


Hari Hari Tech

"con[0]");
sapgui_select_active_connection("con[0]");
sapgui_select_active_session("ses[0]");
/*Before running script, enter password in place of asterisks in logon function*/
sapgui_logon("JUNIOR{UserNumber}",
"ides",
"800",
"EN",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui102",
END_OPTIONAL);

Hari Tech Page 115


Hari Hari Tech

2. SAP GUI Protocol:


SAP GUI is a client server application SAP logon pad version is 7.3

The SAP GUI Vuser script typically contains several SAP transactions which make up a
business process. A business process consists of functions that emulate user actions. Open
the Step Navigator to see each user action as a Vuser script step.

The following example shows a typical recording of a SAP GUI client. The first
section, vuser_init, contains the opening of a connection and a logon.

Note: The Open Connection step uses one of the connection names in the SAP
Logon Descriptions list. If the specified connection name is not in the list, the Vuser looks for a
server with that name.

In the following section, the functions emulate typical user operations such as menu selection
and the setting of a check box.

The final section, vuser_end, illustrates the logoff procedure.

When recording a multi- protocol script for both SAP GUI and Web, VuGen generates steps for
both protocols. In the Script view, you can view both sapgui and web functions.

Hari Tech Page 116


Hari Hari Tech

The following example illustrates a multi-protocol recording in which the SAP GUI client opens
a Web control. Note the switch from sapgui to web functions.

Prerequisites to work on SAP GUI protocol:

1. We have to install SAP logon pad.(VUgen as well as in LG’s)


2. Configure in the connection string is SAP logon pad.
3. Enable client side , server side scripting.
4. Change the notifications “ask to allow”.

Configure Connection String:

1. Get the connection string from client.


2. Right click => add new entry.
3. Change connection type to “Group/server selection”.
4. Click finish button by providing description ,messege server , SAP router.
5. By importion .ini file also we can configure the connection.
 Gotothe SAPlogonoptions, navigationtotheaccessibility& scripting => check enable
scripting.
 Server side scripting :
Login to application
Using R2 level T-code we can enable the server side scripting. “RZ11”.

Example:
sapgui_tree_double_click_item("Use as general WWW browser, REPTITLE",
"shellcont/shell",
"000732",
"REPTITLE",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1020",
END_OPTIONAL);
...
sapgui_set_text("",
"http:\\\\yahoo.com",
"usr/txtEDURL",
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1021",
END_OPTIONAL);

Hari Tech Page 117


Hari Hari Tech

3. Web Services Protocol:


If the application is communicating with the help of 3 rd party services (XMB/Rest Ful
XMLs/JSONs) we have to use web service protocol.

If the application is developed in SOAP. We can develop the scripts in 2 ways using
below protocols.

1. Web HTTP/HTML.
2. Web Services.

1. Web HTTP/HTML Protocol:

Pre-requisites:

1. We have to request the project team to provide the WSDL file for business flow.
2. Validate the WSDL file in SOAP UI tool.

SOAP UI (Versions 3.5/4.6):

 Open the SOAP UI.


 Create new project.
 New Project.
 Provide the project name.
 Provide the WSDL File Path.
 Click on OK button.

Select the XML in request plan. Execute the XML by providing authentication details
and method type.

Verify the response whether it is correct or not by validating HTTP status code &
XML.

1. Web HTTP/HTML Protocol:

We can create the same request using Web (HTTP/HTML) protocol. You need take the xml
request as shown in the following and place in the web custom request.

You need to keep this soap request in the web request body. As shown below and you can
capture all the response using correlation function. You can also add check point using
web_reg_find(). The url should end with .asmx as shown in the request.
 Copy the web_custom_request( ) syntax to the Vugen.
 Copy the end path URL, and paste into web_custom_resuest() url.
 Copy the XML, and paste into web_custom_request( ) body.

Hari Tech Page 118


Hari Hari Tech

 Use add web_add_header() information for authentication and header


information.

XML Request Example for Web Custom Request


web_reg_find("Text/IC=New Delhi",
LAST);

web_reg_save_param_ex(
"ParamName=Web Service Response",
"LB=",
"RB=",
SEARCH_FILTERS,
LAST);

web_custom_request("Weather SOAP Request",


"URL=http://www.webservicex.net/globalweather.asmx",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Mode=HTML",
"EncType=text/xml; charset=utf-8",
"Body= Your Request should be here as shown in the following image"
LAST);

Hari Tech Page 119


Hari Hari Tech

Web Custom Request with Web Services

Note: Correlation, parameterization capturing and is same like web HTTP/HTML protocol.

1. Importing the service directly to vugen:

I have taken weather web service as example shown in this link.

i. Open the Vugen.


ii. Choose the web services protocol.
iii. Choose the SOA tool.
iv. Choose the Manage services.
v. Import the services by clicking on “Import Buffer”.
vi. By providing the URL of the services.
vii. Provide the connection details if it require.
viii. Click on add service call.
ix. Provide the operation name, Input & Output arguments.

(or)
Steps:
1. First open the vugen and select Web Services protocol.
2. Click on Manage Services on top nav bar and Click on Import and give the WSDL URL
which is usually ends with wsdl
http://www.webservicex.net/globalweather.asmx?WSDL.

Hari Tech Page 120


Hari Hari Tech

Now Click on Add Web Service Call on top nav bar. Give the Input Arguments and Leave the
out put arguments empty. And click on ok. As shown in the following image.

Input Arguements in Web Services


It will create a script in loadrunner as shown below. You can perform the steps one by one in this
way for all the web services steps. You can use lr_xml_find and lr_xml_get_values to validate
the page.
web_service_call( "StepName=GetCitiesByCountry_101",
"SOAPMethod=GlobalWeather|GlobalWeatherSoap|GetCitiesByCountry",
"ResponseParam=response",
"Service=GlobalWeather",
"ExpectedResponse=SoapResult",
"Snapshot=t1396977083.inf",
BEGIN_ARGUMENTS,
"CountryName=India",
END_ARGUMENTS,
BEGIN_RESULT,
END_RESULT,
LAST);

Enhancements:

To capture the dynamic value from the above request. We used below request

Lr_xml_get_valules(“XML={response}”, // input argument

“valueparam=outputparam”, //output argument

“query=//sendSMSResult”, //query string like LB/RB

LAST);

Hari Tech Page 121


Hari Hari Tech

Verification Points:

Lr_xml_find(“XML={response}”,

“value=name is”,

“query= //sendSMSresult”,

LAST);

2. By invoking the SOAP UI through Vugen:

1. Open the Vugen.


2. Invoke the SOAP UI by providing SOAP UI file path.
3. Then execute the all the requests under project.
4. Above process will allow you to record the objects with the help of SOAP request.

Note:

Correlation we can capture the dynamic values with the help of lr_xml_get_values( ).

Hari Tech Page 122


Hari Hari Tech

4. Web click & Script Protocol

Web click & script protocol records the actions which are performed against the browser
(or) it will record the only browser specific actions. There is no correlation values in Vugen
script.

Functions:
1. web_browser(): Performs an action on a browser.

2. web_edit_ field(): Enters data for a text field/ input purpose

3. web_image_submit(): Emulates a user clicking on an image that fires a submit request.

4. web‐image_link(): Emulates a user clicking on an image that is a Hyper text link

5. web_list(): Select an item from a list control/Drop down list

6. web_radio_group(): selects one button from a radio button group.

Click & Script:

1. Records the browser specific actions

2. Correlation is not required

3. Recommended for GUI based apps.

4. Records the objects in terms of X.Y co‐ordinates

5. Identified some deviations in response times when compared with HTTP Protocol

HTTP/HTML
1. Records the communication b/w client & server.

2. Correlation is required

3. Recommended for any web apps which is communicating in HTTP Protocol

4. Records the objects in terms of GET & POST Requests

5. It will give accurate Response times.

Hari Tech Page 123


Hari Hari Tech

Record time options:


Recording
1. GUI Level: It will generate a step for every user actions
2. HTML Level
3. URL Level

Challenges and Enhancements:


 While recording your script password will be present in encrypted format, we have to
change to normal format. Ex: set value=jojo; set value= bean
 All the clicks will be recording in screen co‐ordinates, we have to convert them to action
format.

NOTE: If image co‐ordinates are changing causes script failure.

Advantages:
1. Correlation is not required
2. Easy to understand & easy to maintain the script
Disadvantages:
1. Response times are slightly different from actual
2. It will generate object for every user action.
Pre requisites (or) Precautions while recording the script:
Which objects (Fields) would like to parameterize those fields should be modify while
recording.

Case study 1:
I have an application which is developed in Java, my business scenario having 10 requests.
Every jsp page having 100 fields which are filling based on my previous input.
Solution: in the above scenario correlate 100s of values/ fields for every page is a different
process.
To avoid conducting/ implementing correlation I switched from HTTP/HTML protocol to click
& script protocol.

Case study 2:
I have an application in that application having multiple tabs. As per the business flow I have
to move Tab1 to Tab2 which is not a server call.
Solution: In the above scenario Tab2 action is not a server call.
To perform continue button I have to navigate Tab1 to Tab2 which is not possible in
HTTP/HTML protocol. So I moved to Click & script protocol.

Case study 3: If the application having GUI interface we can use Click & script protocol.

Hari Tech Page 124


Hari Hari Tech

5. RTE (Remote Terminal Emulator) Protocol

RTE: If the application developed in Unix environment we have to use RTE Protocol.
Ex: Client server apps and cursor based apps (or) Min frame apps.

Recording Options:
1. Configuration
2. RTE: RTE having two options to handle synchronization. It will generate 2 automatic
functions like
 Te_wait_cursor()
 Te_wait_text()
Options:
1. Cursor
2. Prompt
Cursor: It instructs the vugen to generate Te_wait_cursor() function to handle synchronization
issue.
Te_wait_cursor() function instructs script execution flow wait for the cursor to be appeared
at a specific location in terminal window.
Prompt: It instructs the vugen to generate Te_wait_text() function to handle
synchronization issue.
Te_wait_text() function instructs script execution flow wait for the text to be appeared in a
designated location.
NOTE: Above 2 functions automatically generate based on your record time options. Both
the functions purpose is to handle synchronization.
Advantages: No correlation
Process to record a simple script:
FileNew ScriptChoose RTE protocol Start recordInvokes the terminal
Session choose communication tab click connect button provide session typeHost
name and port numberok

Functions:
1. Te_connect(): Connects the terminal emulator to the specified Host.
2. Te_type(): sends a string to the terminal emulator (or) Input purpose.
Ex;Te_type(“Username”):
3. Te_wait_cursor(): Waits for the cursor to appear at a specified location in a terminal
window.
4. Te_wait_text(): Waits for a text string appear at a designated location.
5. Te_wait_sync(): It instructs the vuser to wait until receives a responsefrom server.
6. Te_get_cursor_pos(): Returns the current location of the cursor in the terminal screen.
7. Te_set_cursor_pos(): Sets the position of the cursor on the terminal screen.
8. Te_getvar(): Returns the value of the RTE system variable.

Hari Tech Page 125


Hari Hari Tech

Challenges:
1. Synchronization issue.
Initially we used Record time options (prompt and cursor) to overcome the synchronization
issue. But we fail to run the test in controller because of the synchronization issue.
Solution: We commented all Te_wait_cursor () & Te_wait_text() functions and written
synchronization function called Te_wait_sync ().
2. To capture some text from on screen.
Scenario: I have a scenario/situation to capture ASN number which is generated from server
and I have to pass the same value in next request.
Solution: Using Te_get_text_line() function captured onscreen text passed it in which
request we required.
3. Error handling:
Solution1: We can use Te_wait_text()/ Te_wait_cursor() functions to overcome /to handle
the Exception pages.
Scenario2: Every response should be validated before perform new action. We have to verify
whether we receive a correct page or exception page.
Solution3: To overcome this issue I developed an external function which will verify whether
we received a correct page (or) Error page (or) warning page (or) Invalid page etc...

Hari Tech Page 126


Hari Hari Tech

6. Citrix ICA Protocol

Citrix_ICA Protocol: If the application deployed in citrix environment we have to use


citrix_ICA protocol. But my current project deployed in citrix. Before accessing this application
we have to connect to the citrix env. Through citrix protocol.

Steps to Access the application:


1. Access the citrix Env. Through URL
2 Provide credentials & access the application which is published in citrix Env.
3. Perform the business scenario against the application.
4. Log off from the application and from citrix.
Pre requisites:
1. Install citrix_ICA agent in vugen as well as in LG machines (Same version of citrix)
2. Use same resolution (Screen) in vugen as well as in LG machines.
3. Avoid mouse clicks while recording the business scenario.

Functions:
1. ctrx_nfuse_connect(): connects to a citrix server via an NFUSE portal.
2. ctrx_sync_on_window(): waits until a window is created (or) become active.
3. ctrx_mouse_click(): Emulates a mouse click on a citrix client sent to a citrix server.
4. ctrx_wait_for_event(): It is a synchronization function that waits for an event to occur.
5. ctrx_get_window_name(): Retrieves the name of the active window.
6. ctrx_type(): Emulates a typing alpha numeric keys.
7. ctrx_key(): Emulates a non‐alpha numeric keys.(Tab,uparrow,dowm arrow...)
8. ctrx_sync_on_bitmap(): waits until a bitmap appears.

Challenges:
1. My test got failed in controller
Cause: citrix_ICA agent version is different in LG & vugen machines.
2. My mouse click objects were failed in controller.
Cause: Resolution is different in LG & vugen machines.
3. Synchronization issue:
Case study 1: Synchronization issue is the biggest issue in citrix protocol. To overcome
synchronization issue we have 4 ways.
i) Based on window name
ii) Based on bitmap value
iii) Based on wait for an event function
iv) Based on sync text

Hari Tech Page 127


Hari Hari Tech

i) Based on window name:


I recorded a script for every action it generayed ctrx_sync_window() function. Which will
wait for the expected window for a specified time.
To perform new action we have to verify whether the correct window appeared or not. For
this verification i used function ctrx_get_window_name() to capture the active window
name.
From the above if the active window name is expected window name then we can continue
to the next action. Else we have to instruct the vuser to wait until specified window name to
be appeared.
ii) Based on the Bitmap value:
Using bitmap hash value we can overcome the synchronization issue.
Using ctrx_get_bitmap_value() we can capture hash value of any image which can compare
with expected Hash value.
iii) Based on wait for an event function:
ctrx_wait_for_event() function wait for a specified event to occur.
iv) Based on sync text():
waits until specified text is displayed around the specific position.
4. Challenge: To capture the specific text from on screen (or) capture dynamic value from
screen
Solution: using ctrx_get_text() function to capture on screen text to handle text verification
points (or) to capture dynamic value.

Hari Tech Page 128


Hari Hari Tech

7. Oracle NCA Protocol

I have an application web interface is interacting with data base via oracle forms for this
scenario I used Web+ Oracle NCA Protocol.
Functions:
1. nca-connect-server ( ): Establishes the connection to Oracle NCA DB server.
2. nca-set-window ( ): indicates the name of the active window.
3. nca-obj-type ( ): sends keyboard input to an object.
4. nca-edit-set ( ): sets the contents of an edit objects.
5.nca-button-press (): Activates the specified push button.

Challenges:
1. Correlation for web objects.
2. NCA objects are recording in the form of ID's instead of object names.
1. Solution:
We have to append the record = Names to the URL. So that it will record objects as
names.
Ex:
2: Set record= name is start up file.
In oracle form server find start up file called Base.html.
3: Set value in form web file and html start up file.

Hari Tech Page 129


Hari Hari Tech

8.The Ajax TruClient User Interface

The Ajax TruClient user interface is made up of the following sections:


1. TruClient Sidebar. The heart of the interface, contains all the tools you need to develop your
Ajax TruClient scripts.

2. TruClient Toolbox. To enhance your TruClient script by adding steps. The toolbox opens and
closes by clicking on the tab, and moves by dragging it up or down.

3. Browser Navigation Bar. Enter the URL of the application for which you are developing a
script.

4. Application Browser Window Develop and replay your script interactively.

5. TruClient Sidebar Status Pane. Displays status details about the active action in the
TruClient Sidebar.

The following lists some of the main differences between the Ajax TruClient protocol and other
VuGen protocols:

Hari Tech Page 130


Hari Hari Tech

The script is visible in VuGen’s script view but it is read only. The script is created and modified
in the TruClient sidebar in the browser (FF or IE).

Ajax TruClient scripts are asynchronous. Steps do not have to wait for previous steps to
complete. Each step defines an End Event which defines the point at which subsequent steps are
allowed to start running.

Ajax TruClient scripts are recorded on the user level, therefore there are no correlations however
the main challenge becomes object identification.

Most of the tasks involved in recording, replaying, and modifying scripts are done using the Ajax
TruClient Sidebar for Internet Explorer or Mozilla Firefox.

Ajax TruClient Step Structure


Ajax TruClient steps are comprised of a number of sections. The sections and elements within
each section vary depending on the type of step.

User interface elements are described below:

Hari Tech Page 131


Hari Hari Tech

Hari Tech Page 132


Hari Hari Tech

Hari Tech Page 133


Hari Hari Tech

Ajax TruClient - Developing a TruClient Script How to Develop Ajax


TruClient Scripts
This task describes the basic steps involved in interactively developing an Ajax TruClient script.

1. Create an Ajax TruClient script from the VuGen toolbar.


2. Configure the General Browser Settings
The Browser Configuration settings allow you to configure settings that apply to all Ajax
TruClient scripts.
The settings are imported to new scripts as they are created.
To edit these settings click the Ajax TruClient General Settings button from the Record toolbar
in the
VuGen main window and select the Browser Settings tab.

3. Configure the Run-Time Settings


In VuGen configure the Run-Time settings before recording and performing a load test. To open
the Run-Time settings dialog box, click F4 or select the Run-Time Settings node from VuGen's
Solution Explorer.

4. Start developing the script


Click to open an interactive recording session in the TruClient Sidebar for
either the Mozilla Firefox browser or the Ajax TruClient browser for IE.

5. Record interactively
Navigate to the desired starting website and click Record button . All of your actions will
be recorded and displayed in the TruClient Sidebar on the left as you perform your business
process. You can stop recording by selecting the Stop button . You can continue recording
from any point in the script.

To record into different section of the script, right-click a step and select Record > Record after
or Record > Record before to begin recording new steps into the desired location in the script.
If you are recording into a group step, select Record > Record into.

6. Replay the script


It is strongly recommended that you replay the script at least two times, correcting any errors that
occur during the process. After two successful consecutive replays, you can move on to the next
step.

During interactive replay, Ajax TruClient will animate each step progress according to its real
running progress by filling the step bar. The step running progress can be for example: finding
the test object, performing the action, or synchronizing the step on its end-event. In addition,
script action details can be seen the TruClient Sidebar Status Pane.

7. Enhance the script


You can enhance your script in a number of ways such as inserting parameters, transaction,
loops, and verification steps.

Hari Tech Page 134


Hari Hari Tech

8. Stop developing
Click the Save button to save the script. Close the browser window. Restore the VuGen
window.

9. Replay the script in Load Mode


Before you run the script in a Controller scenario, run the script in VuGen's load mode. From the
VuGen main window, click the Replay button to replay the script in Load Mode. Progress
can be monitored in the Replay log. The browser does not open, and snapshots are not displayed.

10. General Tips Regarding Successful Interactive Replay


Do not resize the browser between record and replay and during replay. This can cause objects to
move and interfere with TruClient's ability to locate them.

Do not switch between applications during interactive replay. Keep the browser in focus.
Note: This is especially important when the Related Objects feature is used, as resizing may
change the relative position of the objects.

Note: Any customizations (such as bookmarks) that you make within this instance of Firefox
will not be saved globally. This is because VuGen opens each script in a unique Firefox profile.
If you want to use Firefox for any use other than creating this script (e.g. browsing the internet),
we recommend that you open an additional Firefox window.

Actions

Hari Tech Page 135


Hari Hari Tech

Hari Tech Page 136


Hari Hari Tech

Ajax TruClient Toolbox


The toolbox enables you to add steps to Ajax TruClient scripts. The toolbox opens and closes by
clicking on the tab and moves by dragging it up or down.

Hari Tech Page 137


Hari Hari Tech

Hari Tech Page 138


Hari Hari Tech

How to Debug Ajax TruClient Scripts


This task describes different options to debug an Ajax TruClient Script.

View Replay Errors in the TruClient sidebar


If any steps failed during replay, they are marked with an error icon. Hover the mouse over
these
icons to view descriptions of the errors.

Hari Tech Page 139


Hari Hari Tech

Run the Script Step by Step


You can run your script step by step to view the replay more slowly and in a controlled manner.
To run the script step by step, select the down arrow from the replay button in the browser and
select Replay step by step. Repeat this procedure after each step to continue the step by step
replay.

View the Replay Logs


In the VuGen Output Pane, you can view details of your script's replay. Select Output Pane >
Replay or the Output Pane > Browser Replay logs.

Insert Toggle Breakpoints


Breakpoints instruct the script to stop running during a replay when in interactive mode. They
can be used to help debug your script. To insert a toggle breakpoint, select the desired step and
click the Breakpoints button.

Debug Scripts Using Snapshots


You can use the snapshots generated during replay to debug scripts by viewing the snapshots of
the failed step(s).
1. Select the button from the TruClient Sidebar and select the Interactive Options tab. Set
the Replay Snapshots Generation to On Error.
2. Replay the script from the TruClient Sidebar.
3. Look in the Output Pane > Replay or the Output Pane > Browser Replay logs for errors.
Note the step numbers of the steps that had errors.
4. To view the snapshots from the TruClient Sidebar, select a step with an error, and select the

● Button.
(Or)
To view the snapshots from VuGen, select View > Snapshot Pane.
You now have a group of snapshots in which errors occurred in the script.

Modify and view script levels


Sometimes, steps that were recorded and are necessary for replay are placed in levels 2 and 3. In
this case, you need to manually modify the level of those steps to level 1.

To modify the script's replay level, drag the slider in the toolbar to the desired level. Dragging
the slider to level 3 displays and replays the steps on levels 1, 2, and 3.

To move a step to a different level, open the step and click on the step section. Move the slider to
the desired level. If the step is part of a group step, both the group step and the individual step
must be modified.

Insert Wait steps


Sometimes a script will fail to replay because an object in a step is not available when the
previous
step has finished. You can resolve this by inserting Wait Steps into your script which pause the
script replay before continuing to the next step. There are two different types of Wait Steps:

Hari Tech Page 140


Hari Hari Tech

The Wait step pauses the script for a defined amount of time before continuing to the next step.
The Wait for Object step pauses the script until a specified object is loaded before continuing to
the next step.

Improve Object Identification


If the Highlight option fails, use the Improve Object Identification

Replacing an object
If you selected the wrong object during recording, or an object has permanently changed you can
replace it with a different object without replacing the step. This effectively resets the step,
deleting changes made to the original step such as relations. Expand the step, select Object, and
click the
Replace button . Select the new object and replay the script. Replace Object will tell Ajax
TruClient that the object currently referenced in the step is incorrect.

Ajax TruClient will remove any current knowledge of the object and learn the object you select
from scratch.
Therefore, you should only use the Replace Object option if the object you used during recording
was the wrong one.

Cannot confirm object


Ajax TruClient suspects a specific object to be the desired object but it cannot be positively
identified. The suspected object is highlighted on the screen, and the following assistant dialog
box
Appears:

Hari Tech Page 141


Hari Hari Tech

Options:
Yes. The suspected (and highlighted) object is the correct object.
Locate. The suspected object is not the right object. You will need to identify the correct object
in the application.
Cancel. Stop the replay.

Multiple objects found


Ajax TruClient found several objects that match the identification of the desired object. All
suspected objects will be highlighted on the screen, and the following assistant dialog box will
appear:

Options:
The correct object is one of the marked objects. Click the object in the application to specify the
correct one.
Locate. The suspected object is not one of the highlighted objects. You will then need to
highlight the correct object in the application.

Hari Tech Page 142


Hari Hari Tech

Cancel. Stop the replay.

Object not found


Ajax TruClient could not find the desired object. The following assistant dialog box will appear:

Options:
Locate. Locate the object. You will need to highlight the correct object in the application.
Cancel. Stop the replay.

How to Select a Random Option from a List


Set the Ordinal argument to 0. TruClient will automatically select a random option from the list.
For example, let's assume you have an auto-complete list that shows a list of cities based on the
typed text. You've currently selected the second option and the step is: Select option #2 from
City autocomplete.

Ajax TruClient Functions and Function Libraries


A TruClient function is a group of steps, such as a login, that you define as a function. Functions
are stored in libraries that can be reused multiple times in a script. Each library can contain
multiple functions.

Each library can be either local or global. A local library can be accessed by the script that
created it. A global library can be accessed by all Ajax TruClient scripts. Additionally, a global
library can be saved on the network and shared between many users.

How to Use External Functions in the Script


Add your JavaScript and C functions to the JS-Function.js and C-functions. c files that are part of
the script and appear in the left navigation pane in VuGen.

JavaScript functions can be called directly from the Ajax TruClient script, as all arguments and
parameters support JavaScript. You can also add an Evaluate JavaScript or LR.evalC step from
the Toolbox for this purpose.

To call C functions add an Evaluate C step from the Toolbox.

Hari Tech Page 143


Hari Hari Tech

Alternative Steps
Alternative steps allow you to view instances in which there are multiple ways to perform the
same action in a step. If Improve Object Identification fails, try using one of the alternative steps.

For example, you may be clicking on an option in a drop down list in which the text changes
based
on some value.

Modify the Object Identification Method


You can modify the way Ajax TruClient identifies the object by modifying the object
identification method in the Object section of the step properties. The following options are
available:

Automatic. Ajax TruClient's default object identification method. The Automatic method allows
Ajax TruClient to use its internal advanced algorithms to locate the object. If this method does
not successfully find the object during replay, click the Improve Object Identification button and
replay the script again.

XPath. If Automatic identification fails, even after using Improve Identification or Related
Objects (described below), try using the XPath identification method. This method identifies the
object based on an XPath expression that defines the object in the DOM tree.

Click the dropdown arrow next to the XPath edit box to select a suggested XPath for the object.
You can
manually modify the suggested path. To revert to one of the original expressions generated by
Ajax TruClient, select one of the options from the drop-down again.

For example, if you need to select the first search result, regardless of the term being searched
for, using XPath identification may help.

JavaScript. JavaScript code that returns an object. For example: document. getElementById
("SearchButton") returns an element that has a DOM ID attribute of "SearchButton".

Using the JavaScript identification method you can write JavaScript code that references the
returned document and can use CSS selectors and other standard functions.

For example, the page returned by the server contains multiple links with the same "title"
attribute
(search results) and we want the script to randomly click on one of the available links.

Object identification for this case, using the JavaScript identification method, may look
something
like this:
var my_results = document.querySelectorAll('a[title="SearchResult"]');
random(my_results);

Hari Tech Page 144


AWR REPORTS

Why we are using AWR report?


A: To analyze the database utilization.

Hard parsing:
In hard parsing, it will follow below steps.
 DB (Database) will fetch sql query from hard disk.
 It will check for syntax and also for Symantec
 It will parse the sql query.
 It will keep in the shared pool memory and fulfil the request.
Soft parsing:
 It will simply fetch passed sql query from shared pool memory and it will fulfil the
request.
 If percentage is 91% then it is good
 If percentage 100% then we need to increase shared pool memory size.

How to generate a report?


Sol:
 Select any monitor which we added.
 Right click on monitor.
 Select "reports" and select "Quick" It will display
quick report pop up window.
 Select "thresholds" and select "options" according to our requirement.
 Select "general"->Graph.
 Navigate to "filter" and schedule settings.
 Select the report period.
 Select the report type (html/text/xml).
 Click on generate report file.

AWR report (Automatic Workload Repository):


 To communicate with remote server we need to install putty.
 In putty we need to provide remote server host name (or) IP address and we need to
provide remote server credentials.
 We have to enter a command {sqlplus"/as sysdba";}
 Click on enter which will prompt to sql prompt.
 In sql prompt we need to enter below one:
SQL>@$ORACLE_HOME/rdbms/admin/awrrpt.
 Click enter which will ask for "Report_type".

AVNR Groups (July-16) Page 145


 Provide report type as html.
 Click enters which will ask for number of days.
 Provide number of dayClick enter.

It will show "snapshot ID's".


And ask for begin snap_IDProvide begin snap id and click enter.
And Ask for end "snap_ID".
Provide end snap_ID and click enter lt asks for
report name. Provide the report name with
extensions (.htm1) click enterexit.

1. Performance Vocabulary

1. Testing Definitions
1. 2x Load – Performance Test run at twice the load of a planned Load 1x.
The idea being we need to ensure the current architecture and
infrastructure will hold up under larger than expected growth rates.
2. Baseline – Is derived from the previous year’s actual peak production load.
These tests ensure production level loads can be successfully tested without
expected growth rates added in.

i
3. Capacity Test – the system is subjected to increasing virtual user load
until response times or error rates become unacceptable. This type of test
determines the current ultimate capacity of the current system.
4. Failover Test – verifies the redundancy mechanisms while under load.
For example, what happens when multiple web servers are being used
under peak expected load, and one of them dies? Does the load balancer
react quickly enough? Can the other web servers handle the sudden
dumping of extra load?
5. E2E Perf Load Test - are end-to-end performance tests under anticipated
production load. The primary objective of this test is to determine the
response times for various time critical transactions and business processes
and that they are within documented expectations (or Service Level
Agreements - SLAs). The test also measures the capability of the application
to function correctly under load, by measuring transaction pass/fail/error
rates.
6. Stability Test – are long duration load tests, typically at a 2x load for the
purposes of assessing the overall reliability of the system under extended
usage, possibly uncovering resource, memory leaks, database connection
pool leaks, and garbage collection issues.
7. Stress Test - determines the load under which a system fails, and how it
fails. This is in contrast to Load Testing, which attempts to simulate
anticipated load. It is important to know in advance if a `stress situation
will result in a catastrophic system failure, or if everything just goes really
slow.

2. Report Information
1. Response Time graph to the Running Vusers graph to see how the
number of running Vusers affects the transaction performance time. For
example, if the Average Transaction Response Time graph shows that
performance time gradually improved, you can compare it to the Running
Vusers graph to see whether the performance time improved due to a
decrease in the Vuser load. If you have defined acceptable minimum and
maximum transaction performance times, you can use this graph to
determine whether the performance of the server is within the acceptable
range.
2. Transaction Response Time (Percentile) graph analyzes the percentage
of transactions that were performed within a given time range. This graph
helps you determine the percentage of transactions that met the
performance criteria defined for your system. In many instances, you need
to determine the percent of transactions with an acceptable response time.
The maximum response time may be exceptionally long, but if most
transactions have acceptable response times, the overall system is suitable
for your needs. The x-axis represents the percentage of the total number of
transactions measured during the load test scenario run. The y-axis
represents the maximum transaction response time (in seconds). It is
recommended to compare the Percentile graph with the Average
Transaction Response Time graph as a higher response time for several
transactions may raise the overall average. However, if the transactions with
a higher response time occurred less than five percent of the time, that
factor may be insignificant to your SLAs.
3. Total Throughput (bytes) – is a link on the Summary report page to the
Throughput graph more specifically to the maximum throughput run during
the test.
ii
4. Average Throughput (bytes/second) – is another link on the Summary
report page to the Throughput graph more specifically pointing to the Average
column.
5. Total Hits – is a link on the Summary report page to the Hits per Second
graph more specifically pointing to the sum of all the hits during the test run.
6. Average Hits per Second – is a link on the Summary report page to the Hits
per Second graph more specifically pointing to the Average column.

3. General Terminologies
a. Controller provides a graphic user interface for controlling and
managing load test scenarios.
b. Group the collection of virtual users, usually running the same script.
c. Scenario is the class that includes a number of scripts to be run, and
specifies the hosts (load generator machines) that will run the scripts and the
virtual user groups associated with each one.
d. Scripts describe the acts that Vusers perform during scenario
executions. When you run a scenario, each virtual user executes a script. The
virtual user scripts include functions that measure and record the performance
of your application.
e. Virtual Users (Vusers) emulate the actions of real users operating
the application under test. A scenario can contain tens or thousands of Vusers.
To emulate conditions of heavy user load, you create a large number of Vusers
that perform a series of tasks.
f. Pacing is a test runtime setting which controls the time between
iterations. The pacing tells the virtual user how long to wait between iterations
of your scripts actions.
g. Logging is a test runtime setting which determines how much
information is logged to the output windows or log files during an execution.
Recommendations here are start with no logging and as issues arise turn low-
level logging on to assist with debugging.
h. Think Time emulates the actual clock time that a virtual user will wait
between actions. This is used in conjunction with Pacing to ensure your user
profile characterization is close to as real life as possible.

2. Performance Testing Checklists


1) Checklist Purpose and Goals
Performance testing is an activity that spans beyond the SQE Performance Testing Team. We help
the project team to understand the role performance testing can play in the software development
life cycle and we rely on other subject matter experts to provide guidance, insight, and support so
that we may conduct a thorough and valid set of performance tests. Performance Test Checklists
help to set expectations for the individuals involved in the performance testing areas of support,
test preparation, test execution, and analysis.
The main purpose of performance testing checklists is to establish criteria for each stage of testing
to improve test quality. While some of these items will be required in order to move forward,
others are important suggestions that should be completed, but will not block testing if they are
not done. This organization will reduce the number of tests repeated due to issues such as miss-
iii
configured servers or a miss-match of software across a server farm. The reduced test cycles will
allow for a more detailed analysis of the test results, which will provide more insight into the
performance of the application under test. Checklists also help ensure that the environment is set
up properly, that proper traffic and data models exist, and that support resources are available
during testing and analysis. Finally, fewer test cycles per project mean more projects can be tested
in the same amount of time.
It is important to note that the SQE Performance Engineer cannot commit to timelines until the
full scope of work is known. That typically means all the pre-project information must be provided
before the final schedule can be set. Without it, the engineer cannot create the Performance Test
Strategy and Performance Test Plan. Even though the information is provided in a timely fashion,
the schedule may need adjustment if unforeseen complexity is discovered

2) Environment Details
Performance testing should not be a black box testing effort restricted to analysis of end-to-end
response times and throughput. Our performance testing tool has the ability to monitor servers
individually as well as many of the components that run on those servers. This additional
information provides valuable insight into the actual operation of the application while under
load. The SQE Performance Engineer needs a high-level architecture diagram of the application
under test along with any design documents and UI or technical specifications in order to fully
understand the application and properly test it. A separate listing of the server specifications
should also be provided so that server, database, and application monitoring can be included in
the performance test results.

3) Project and Build Schedules


Proper performance testing requires enough time to set up the environment, create the test data,
develop the test scripts, create the test scenarios, execute the tests, analyze the results, and
communicate the findings to the project team. New builds sometimes require the re-writing of
scripts to accommodate the changes. Builds for performance testing should be restricted to those
that actually affect performance. However, the final version must undergo a full suite of
performance tests regardless of the level of performance improvements for it.
The SQE Performance Test engineer must have the overall project schedule and the proposed
build schedule. The engineer will use the information to determine test timelines and inform the
project team (including the Performance Team Lead) of any slack in the schedule or any
unreachable dates. The engineer can also provide input into the creation of the schedule so that
full performance testing is possible. Finally, extra time should be provided for unforeseen issues
that typically arise during script and data creation.

4) Contact Lists
The SQE Performance engineer must have access to other subject matter experts to support the
performance testing effort. The most crucial contact is the Technical Project Manager (TPM), who
is the liaison between the engineer and the rest of the project team. The following list details the
contact list by role. However, some individuals may serve more than one role.
Product Manager – This person will determine the use cases that must be turned into performance
test cases and help decide the transaction targets for the performance tests.
Engineer/Developer – an SME who can speak to the way the application works at the code level.
Multi-tiered or component applications may require a separate contact for each tier/component.
Systems Architect – the architect who designed and/or implemented the application.
Systems Administrator – an SME who understands how the hardware is connected and can

iv
provide support during the actual performance tests.
Database Administrator (DBA) – an SME who understand the database of the application under
test.
Functional QA Analyst – the person who will execute the manual test cases.
SQE Performance Engineer – the person who will execute the performance tests.

5) Test Types

Performance testing is an umbrella term that describes several types of tests that are used to
measure the performance requirements or expectations of the project and product teams. The
current standard for LTG is to execute 1X (anticipated peak load), 2X (double anticipated peak
load), and longevity (24 hours at 1X) tests at a minimum, and to execute any additional testing per
the needs of the project. Additional testing can be accommodated as needed. The following list
details the different testing types.
Component – tests an individual component without full integration with the rest of the
application. This type of tests allows testing to start before the full application is available and
provides development/engineering with some insight into expected performance.
Load – tests the application at given user level (e .g. 100 users, 1X). This type of test is used to
ensure a given platform meets requirements and provides some insight into the ability to handle
future growth and helps with hardware planning.
Scale/Capacity – tests that determine the limit of a given set of hardware and/or configuration.
This type of test helps determine the number of servers to support a required user population.
Duration – tests run for extended periods that typically involve at least 1 work shift and serve to
evaluate the stability of the application. The LTG standard is 24 hours.
Tuning – tests to configure settings and hardware to optimize performance. This type of test is
conducted after the code is optimized for performance.

6) Workload Modulation
A proper performance test requires that the application receive traffic similar to what will be seen
in production. Workload Characterization (i. e. the traffic model) defines how the test cases are
run. It is usually defined as some type of rate (e. g. transactions/hour) with or without a certain
level of concurrency among the user population. Using an inaccurate traffic model may skew
results or provide a false sense of security. These numbers are done at the test case level, meaning
each test case will have its own transaction targets and set of virtual users, which should match the
expected concurrency.

7) Data Modelling

The data model describes the types of users that will be used to execute the performance test
scripts. Examples include instructors, students and administrators. Each test case will have its
own user type and these users must have the same characteristics as the production users they will
emulate, such as number of classes, number of tests taken, etc. The SQE Performance Engineer
generally creates the testing data based on the characteristics of the users.
The data model also describes the initial condition of the database. The testing database must be
the same order of magnitude as the production database and have a similar user population.
Classes and any other relevant test information should mimic production as much as possible to
simulate a real world experience.

v
8) Performance Metrics
The purpose of testing is to verify the application meets expected results (i.e. response times,
concurrency and any other known service level agreements). Performance metrics are the means
that we will use to measure performance. Test results will be compared to performance targets and
the relevant information will be communicated to the project team. Performance metrics include
response times, server utilization, and uptime.
Monitoring metrics provide the information used to compare test actual results to test goals (e.g.
performance metrics). The LTG standard is to measure response time, throughput, and some
server metrics (Memory, Disk, and CPU). However, application servers and database can be
monitored using APpynamics tool. These metrics are integrated with the test tool so that several
metrics can be placed on the same graph without worry about timestamp correlation. However,
the project team must work with the performance engineer to define additional monitoring.

9) Test Reports
Test results will be maintained in a single spreadsheet under source control. While the
performance test report will provide the bulk of the results, the other SMEs (e. g. systems,
engineering/development, database, and test) must also report on their respective pieces so that a
full evaluation of the application can be made

10) Pre-Test

These are the items that must be completed before a test can start and are done once per test. It
ensures that everything is in the proper state before testing begins so that the test cycle is not
wasted unnecessarily.

a) Environment Availability
The environment must be available as per the PPE calendar. The SQE Performance Engineer will
coordinate with other engineers and the environment administrator to ensure the environment is
dedicated to only one test at a time. Concurrent tests are considered only if they do not share
components, but please be aware they all share the same group of load generation equipment and
network. The SQE Performance Engineer will coordinate with the SQE Performance Testing Team
with respect to test equipment used to generate load.

b) Stable Environment
A proper performance requires a fully functional environment which is a replica of production.
Servers must be configured as they will be in production and the application settings must match
what will be done in production. The Release Manager and TPM must verify that the application
has been installed correctly with the correct settings. A functional smoke test and handoff must be
conducted to verify major functionality is working as expected. Where issues remain there must
be a judgment call made to determine whether performance testing should continue on the
current build.

c) Test Support
Every performance test requires systems and database support both for monitoring and resolution
of issues. Testing becomes delayed when time is used tracking down an issue observed during the
test or communicating issues to new resources on the project. Under tight situations, the test
window may be given to another project because the test cannot continue, possibly delaying the

vi
project even further.

d) Performance Team
The SQE Performance Engineer will verify the tests assets and equipment once the environment
has been verified. The engineer will run a small performance smoke test and will send out
notification to stakeholders once that smoke test passes.

11) Post-Test
These are the items that must be completed before the next test can start. It is done once per test
and helps determine the best next steps.

a) Test Analysis Findings


The SQE Performance Engineer will provide the test start and end times along with an HTML
report of the LoadRunner findings. The other SMEs (e. g. systems, engineering/development, and
database) will report on their individual areas.

b) Review Meeting
The TPM schedules a meeting to discuss the test results and determine next steps. Testing
continues when the results are deemed successful or if any issues have been found or resolved
satisfactorily.

c) Post-Project
These are the items that must be completed before the project can be closed and is done once per
project.

d) Review Meeting
The project team will meet to discuss the overall test results. Each baseline will be evaluated and a
decision regarding accepting it or running it again will be decided.

e) Readiness Release Meeting


The SQE Performance Engineer will provide information for the readiness release meeting and be
available to explain findings. The group must sign off on the test results.

f) Executive Summary
The SQE Performance Engineer will provide a report that summarizes the test results and
findings.

3. Performance Test Script-Best practices


Project performance scripts should be reviewed with performance team or with the assigned
backup resource to make sure there is familiarity.
Document:
Each script should be documented describing script functionality along with anything unusual the
script is doing.

vii
Each transaction should have a short comment describing the user transaction being simulated
(e.g. "Enter Course ID and Submit") - best done at recording time. This helps if any parts of the
script need to be re-recorded.
Any additional logic should have a description of what is being done.

Keep Scripts as Simple as Possible:


Team members/backups should be able to understand, execute and troubleshoot scripts if
needed.Always keep in mind that excessive script logic and parsing will add to load generator
resource consumption.

Accurate Workload Model:


Make sure that the test scripts execution represents the workload model you want to simulate.
Validate that each script is using adequate parametrization with sufficiently sized pool of data
values to realistically simulate the business scenario.Accurate Correlation of Dynamic Values:
Make sure to properly correlate any dynamic values.

Transaction Timings:
Use a meaningful, descriptive naming convention.
Timers should frame logical user transactions.
Think times should be outside of transaction timers:
Although it is possible to filter think times out after test is run, the next person may not realize
filtering is needed.

Error Checking:
Use robust error checking for each page/transaction returned.User response assertions for all
required flows.Web services testing should check multiple values within the XML to make sure the
full response is returned. Sometimes with web services it is also good to do a content check for
error codes.

Jmeter
About the Tutorial
jMeter is an open source testing software. It is 100% pure Java application for load and

vii
performance testing.
jMeter is designed to cover various categories of tests such as load testing, functional testing,
performance testing, regression testing, etc., and it requires JDK 5 or higher.
This tutorial provides an in-depth coverage of jMeter framework including its test plans,
listeners, functions, and regular expressions.

Audience
This tutorial is designed for software professionals in the domain of Testing who are required to
test enterprise-level applications for robustness and reliability.

Prerequisites
Before proceeding with this tutorial, you should have a basic understanding of Java
programming language. As you are going to use jMeter to perform all types of testing
(regression, functional, load, performance, etc.) at different stages of a Java project, it is
recommended that you have a good grip over software development and software testing
processes.

ix
TableofContents
About the Tutorial ......................................................................................................................i
Audience .....................................................................................................................................i
Prerequisites ...............................................................................................................................i

Copyright & Disclaimer ..............................................................................................................i

Table of Contents ...................................................................................................................... ii

1. JMETER ─ OVERVIEW ............................................................................................................. 1

What is JMeter?......................................................................................................................... 1

JMeter Features......................................................................................................................... 1
How JMeter Works? .................................................................................................................. 2

2. JMETER ─ ENVIRONMENT ..................................................................................................... 3

System Requirements ................................................................................................................. 3

3. JMETER ─ TEST PLAN .............................................................................................................. 7

What is a Test Plan? .................................................................................................................. 7


Writing a Test Plan .................................................................................................................... 7

4. JMETER ─ TESTPLAN ELEMENTS ....................................................................................... 12

Thread Group .......................................................................................................................... 12

Controllers ............................................................................................................................... 13
Listeners .................................................................................................................................. 15
Timers ...................................................................................................................................... 15
Assertions ................................................................................................................................ 16

Configuration Elements........................................................................................................... 17
Pre-processor Elements ........................................................................................................... 18
Post-processor Elements .......................................................................................................... 18

Execution Order of Test Elements ........................................................................................... 19

x
5. JMETER ─ WEBTEST PLAN ................................................................................................... 20

Start JMeter ............................................................................................................................. 20

Rename the Test Plan .............................................................................................................. 20

Add Thread Group ................................................................................................................... 21


Add Sampler ............................................................................................................................ 22

Add Listener ............................................................................................................................ 24


Run the Test Plan .................................................................................................................... 24
View the Output ....................................................................................................................... 25

6. JMETER ─ DATABASETEST PLAN ....................................................................................... 28

Create JMeter Test Plan .......................................................................................................... 28

Adding JDBC Requests............................................................................................................ 29

Create Listener ........................................................................................................................ 31


Save and Execute Test Plan ..................................................................................................... 32

7. JMETER ─ FTPTEST PLAN..................................................................................................... 34

Rename Test Plan .................................................................................................................... 34

Add Thread Group ................................................................................................................... 34


Add Sampler – FTP Request .................................................................................................... 35
Add Listener ............................................................................................................................ 36

8. JMETER ─ WEBSITETEST PLAN .......................................................................................... 40

Create Webservice Project ....................................................................................................... 40

Create JMeter Test plan........................................................................................................... 43

9. JMETER ─ JMSTEST PLAN .................................................................................................... 49

Building a JMS Point-to-Point Test Plan ................................................................................ 50


Building a JMS Topic Test Plan .............................................................................................. 55

10. JMETER ─ MONITORTEST PLAN ......................................................................................... 63

Setup Tomcat Server ................................................................................................................ 63

xi
Write JMeter Test Plan ............................................................................................................ 65

11. JMETER ─ LISTENERS ........................................................................................................... 71

Default Configuration ............................................................................................................. 71


CSV Log format ....................................................................................................................... 72

Saving Response Data.............................................................................................................. 73

Loading (Reading) Response Data........................................................................................... 73


Saving the Listener GUI Data.................................................................................................. 73

12. JMETER ─ FUNCTIONS .......................................................................................................... 74

JMeter Functions and User Variables ..................................................................................... 74


List of Functions...................................................................................................................... 74

Where to Use Functions and Variables? .................................................................................. 76


Referencing Variables and Functions...................................................................................... 77
The Function Helper Dialog.................................................................................................... 77

Pre-defined Variables .............................................................................................................. 78


Pre-defined Properties ............................................................................................................. 78

13. JMETER ─ REGULAR EXPRESSIONS ..............................................................................................79

14. JMETER ─ BEST PRACTICES.............................................................................................................84

xii
JMete
1. JMETER─OVERVIEW

Before going into the details of JMeter, let us first understand a few jargons associated with the
testing of any application.
 Performance Test: This test sets the best possible performance expectation under a given configuration of
infrastructure. It also highlights early in the testing process if any changes need to be made before the
application goes into production.

 Load Test: This test is basically used for testing the system under the top load it was designed to operate
under.

 Stress Test: This test is an attempt to break the system by overwhelming its resources.

What is JMeter?
JMeter is a software that can perform load test, performance-oriented business (functional) test,
regression test, etc., on different protocols or technologies.
Stefano Mazzocchi of the Apache Software Foundation was the original developer of JMeter. He
wrote it primarily to test the performance of Apache JServ (now called as Apache Tomcat
project). Apache later redesigned JMeter to enhance the GUI and to add functional testing
capabilities.
JMeter is a Java desktop application with a graphical interface that uses the Swing graphical API.
It can therefore run on any environment / workstation that accepts a Java virtual machine, for
example: Windows, Linux, Mac, etc.
The protocols supported by JMeter are:
 Web: HTTP, HTTPS sites 'web 1.0' web 2.0 (ajax, flex and flex-ws-amf)
 Web Services: SOAP / XML-RPC
 Database via JDBC drivers
 Directory: LDAP
 Messaging Oriented service via JMS
 Service: POP3, IMAP, SMTP
 FTP Service

JMeter Features
Following are some of the features of JMeter:
5
JMeter

 Being an open source software, it is freely available.


 It has a simple and intuitive GUI.

 JMeter can conduct load and performance test for many different server types: Web - HTTP, HTTPS,
SOAP, Database via JDBC, LDAP, JMS, Mail - POP3, etc.

 It is a platform-independent tool. On Linux/Unix, JMeter can be invoked by clicking on JMeter shell script.
On Windows, it can be invoked by starting the jmeter.bat file.

 It has full Swing and lightweight component support (precompiled JAR usespackages javax.swing.* ).

 JMeter stores its test plans in XML format. It means you can generate a test plan using a text editor.

 Its full multi-threading framework allows concurrent sampling by many threads and simultaneous sampling
of different functions by separate thread groups.

 It is highly extensible.

 It can also be used to perform automated and functional testing of the applications.

How JMeterWorks?
JMeter simulates a group of users sending requests to a target server, and returns statistics that
show the performance/functionality of the target server/application via tables, graphs, etc.
Take a look at the following figure that depicts how JMeter works:

6
JMeter

7
JMete
2. JMETER─ENVIRONMENT

JMeter is a framework for Java, so the very first requirement is to have JDK installed in your
machine.

System Requirements
JDK 1.6 or above.

Memory No minimum requirement.

Disk Space No minimum requirement.

Operating System No minimum requirement.

Step 1 - Verify Java Installation


First of all, verify whether you have Java installed in your system. Open your console and
execute one of the following java commands based on the operating system you are working on.
OS Task Command

Windows Open Command Console c:\> java -version

Linux Open Command Terminal $ java -version

Mac Open Terminal machine:~ joseph$ java -version

If you have Java installed in your system, you would get an appropriate output based on the OS
you are working on.

OS Output

8
Windows java version "1.7.0_25"

9
JMeter

Java(TM) SE Runtime Environment (build 1.7.0_25-b15)


Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Linux java version "1.7.0_25"


Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

Mac java version "1.7.0_25"


Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)

If you do not have Java installed, install the Java Software Development Kit (SDK) from
http://www.oracle.com/technetwork/java/javase/downloads/index.html. We are assuming Java 1.7.0_25 as
the installed version for this tutorial.

Step 2: Set Java Environment


Set the JAVA_HOME environment variable to point to the base directory location, where Java is
installed on your machine. For example:
OS Output

Windows
Set the environment variable JAVA_HOME to C:\Program
Files\Java\jdk1.7.0_25

Linux export JAVA_HOME=/usr/local/java-current

Mac export JAVA_HOME=/Library/Java/Home

Append Java compiler location to System Path.


OS Output

Windows
Append the string; C:\Program Files\Java\jdk1.7.0_25\bin to the end of the system variable,
Path.

9
JMeter

Linux export PATH=$PATH:$JAVA_HOME/bin/

Mac not required

Verify Java Installation using java -version command as explained above.

Step 3: Download JMeter


Download the latest version of JMeter from http://jmeter.apache.org/download_jmeter.cgi. For this tutorial,
we downloaded apache-jmeter-2.9 and copied it into C:\>JMeter folder.

The directory structure should look like as shown below:


 apache-jmeter-2.9
 apache-jmeter-2.9\bin
 apache-jmeter-2.9\docs
 apache-jmeter-2.9\extras
 apache-jmeter-2.9\lib\
 apache-jmeter-2.9\lib\ext
 apache-jmeter-2.9\lib\junit
 apache-jmeter-2.9\printable_docs

You can rename the parent directory (i.e. apache-jmeter-2.9) if you want, but do not change any
of the sub-directory names.

Step 4: Run JMeter


After downloading JMeter, go to the bin directory. In this case, it is
/home/manisha/apache-jmeter-2.9/bin. Now click on the following:

OS Output

Windows jmeter.bat

Linux jmeter.sh

Mac jmeter.sh

10
JMeter

After a short pause, the JMeter GUI should appear, which is a Swing application, as seen in the
following screenshot:

This is the main page and the default page of the tool.

11
JMete
3. JMETER─TESTPLAN

What is aTest Plan?


A Test Plan can be viewed as a container for running tests. It defines what to test and how to go
about it. A complete test plan consists of one or more elements such as thread groups, logic
controllers, sample-generating controllers, listeners, timers, assertions, and configuration
elements. A test plan must have at least one thread group.

Writing a TestPlan
Follow the steps given below to write a test plan:

Step 1: Start the JMeter Window


Open the JMeter window by clicking /home/manisha/apache-jmeter-2.9/bin/jmeter.sh. The JMeter window will appear
as shown below:

This is a plain and blank JMeter window without any additional elements added to it. It contains
two nodes:

12
 Test Plan node: It is where the real test plan is kept.


13
JMeter


 Workbench node: It simply provides a place to temporarily store test elements while not in use, for
copy/paste purposes. When you save your test plan, Workbench items are not saved with it.

Step 2: Add/Remove Elements


 Elements (which will be discussed in the next chapter Test Plan Elements) can be added to a test plan by right-
clicking on the Test Plan node and choosing a new element from the "add" list.

Alternatively, you can load an element from a file and add it by choosing the "merge" or "open"
option.
For example, let us add a Thread Group element to a Test Plan as shown below:

To remove an element, make sure the element is selected, right-click on the element, and choose
the "remove" option.

13
JMeter

Step 3: Load and Save the Elements


To load an element from file:
 Right-click on the existing tree element to which you want to add the loaded element.

 Select Merge.

 Choose the file where you saved the elements.

 JMeter will merge the elements into the tree.

By default, JMeter does not save the element, you need to explicitly save it.

14
JMeter

To save a tree element:


 Right-click on the element.
 Choose the Save Selection As ... option.

JMeter will save the element selected, plus all the child elements beneath it. By default, JMeter
doesn't save the elements, you need to explicitly save it as mentioned earlier.

Step 4: Configure the Tree Elements


Any element in the Test Plan can be configured using the controls present in JMeter's right- hand
side frame. These controls allow you to configure the behavior of that particular test element. For
example, the Thread Group can be configured for a number of users, ramp up periods, etc., as
shown below:

15
JMeter

Step 5: Save the Test Plan


You can save an entire Test Plan by using either Save or "Save Test Plan As ..." from the File menu.

16
Step 6: Run the Test Plan
You can run the Test Plan by clicking Start (Control + r) from the Run menu item. When JMeter starts
running, it shows a small green box at the right-hand end of the section just under the menubar.

The numbers to the left of the green box are the number of active threads / total number of threads. These only
apply to a locally run test; they do not include any threads started on remote systems when using client-server
mode.

Step 7: Stop the Test Plan


You can stop your test in two ways:
 Using Stop (Control + '.'). It stops the threads immediately ifpossible.
 Using Shutdown (Control + ','). It requests the threads to stop at the end of any current work.

Page 146
5. AWS setup
 How to Launch instance in AWS

1. First step is to Launch the instance.To get into this step first you need to get a pearson aws
account(Contact sherry perkins for creating or getting new account).if you already have one please
proceed with next steps
2. Login to AWS Console:https://lt-perftest.signin.aws.amazon.com/console.
3. After Login Click on AMI's
4. Search for below listed AMI name and right click and Setup the Instance mentioned Instance Setup
page
5. Click the AMI and right click

6. Click launch and select instance to be setup(choose m3.xlarge)

7. Click On configure Details and Provide the number of instances to be Generated.As best
practice use one as Controller and rest as agents.((use default)

Page 147
8. Click Add Storage(use default)

9. Click Tag and add instance tag name (eg:-projectname_Controller/agent)

10. Click Configure Security group

Page 148
11. Click Review and Launch

12. Click launch

Page 149
13. Launch Instances .After clicking it will take to next page where instance launch status will be displayed(shown
instance from a sample image.Make sure you launch instance which are provided to you for specific platform)

14. Wait for Pending status to Running.Once status is in Running state RDP using Public DNS using
 Create AMI Image
 After creating new script or modifying existing scripts or data changes create a new image
by navigating to AWS console.
 Select the Instance from which snapshots needs to be taken.Right client on instance and
select image

 Click on Create image and provide project/platform name followed by release name/date
 After successful completion of image creation terminate the instance

Page 150
6. How to run Load Test using AWS
1. Login to the controller instance using RDP
2. Create Jmeter Project by invoking Jmeter.bat located in Deskptop
3. Start recording Jmeter scripts
4. Follow the steps given in Jmeter helpfor recording
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf Expand your WorkBench and
select the HTTP(S) Test Script Recorder
5. Just a simple, small-scale test on your local machine is all it takes. If it doesn't work, then go back and
fix it before continuing onwards.You can choose to un-check the 'Capture HTTP Headers' box under
'Test plan content'
o You can choose to automatically create an empty Response Assertion after every applicable
page
o You can change the Grouping to change how the Recorder organizes the generated script. It is
recommended to not use groupings.
o Now, once you're all set up and your browser's settings are configured, you can hit 'Start' and
perform your test in-browser! All results will go within your 'Recording Controller'.Once
finished, stop the proxy from JMeter and return your browser back to normal network settings.
You now have a recorded script to adapt and parametrize into a full-blown Test Plan!
Running Loadtest
1. Navigate to c:\apache-jmeter-2.10\Projects or c:\apache-jmeter located in AWS controller machine
2. Replace variables in runtest.bat file located in same location.Replace variables in Jmx file before
starting this test.See below the sample for more details

Page 151
3. Set all values in the Settings section and extra arguments section in bat file
4. Replace same variables in cd %JMETER_HOME%\bin section , Runtest.bat file located in c:\apache-jmeter-
2.10\Utilities folder.Instances launched using specified platform names in AMI will have this folder
structure.(eg:search for Easybridge,realize,dash in AMI and launch m3.xlarge instance)

5. After making changes in both bat files ,update instace ids in remote_host_ids.txt file located in c:\apache-
jmeter-2.10\Projects\.Instance ID’s are generated after instances are launched in AWS from a specified AMI.

Page 152
6. Eg- if you are using 10 instances to run load test ,copy all the instace ids from aws console and update the
remote_host_id.txt file.Separate instance id’s with comma.
7. To run the test open the runtest.bat in c:\apache-jmeter-2.10\Projects.After starting test following screen will
appear and a new folder with current date and time will be created under result folder.

Page 153
8. JTL files will be created under reports folder and it will update every 30 seconds.During runtime ,reports can
be viewed by opening jmeter GUI and point this JTL file in any of the listeners(aggregrate report,response time over
time graph,tps graphsetc)

9. Once test is completed collate reports generated in result folder along with server side measures captured using
AD or any monitoring tools available.
Page 154
7. Aframework
Overview

AFrame is a JMeter test harness designed to integrate Jenkins CI and JMeter load testing with cloud
infrastructure, currently AWS. In short AFrame automates the process of executing a JMeter test end to end from
machine creation through machine termination.
Jenkins URL:Specific to each project

When To Use AFrame


Any time there is high confidence with a JMeter script, it may be eligible for AFrame. High confidence means
that the particular script is vetted thoroughly and executed multiple times to ensure the data and script flow is
correct. Due to lack of run-time transparency and real time visuals, it is not advised to run scripts for the first
time through AFrame.

Setup
In general the process for deploying a JMeter script onto AFrame is straightforward. There are two steps to the
process: First the JMeter script (JMX) must be prepared and compatible with the framework. This process
moves all script configurations into an external property file. The updated script along with the new property file
and any script data make up what is called ABundle, which is then placed onto stash. The second step of AFrame
is to configure Jenkins CI to know how to use the new ABundle. The benefit of this architecture is that in order to
change test targets only the external configuration file must be edited.

AFrame Automated Process


1) Create Jenkins slave node on AWS (JMeter controller)
2) Clone ABundle to slave node
3) Read property file and extract configurations
4) Create JMeter load generator AWS instances, and wait for all AWS status checks.
5) Transfer all data files to each load generator
6) Execute JMeter test using newly created instances
7) Print "summarizer" updates to Jenkins console during test execution
8) Generate HTML report and archive to Jenkins Master
9) Terminate all load generator machines
10) Master will eventually terminate any idle slave nodes (JMeter controller)

Page 155
8. Report Template
Performance Test results must be published at the end each iteration or before release readiness to all
stakeholders/team, with all the following parameters included in result template. Maintain results in confleunce
or google sheets to ease of use and accessibility.Report should cover both client side and server side metrics.

Template sample:-https://docs.google.com/spreadsheets/d/1s2d4jkiDrHTm9lbbPTICwkluEUGY-
4IUaJUlcGGBURQ/edit

9. Application Monitoring
Pearson use Appdynamics for application performance monitoring.All platforms application performance can be
tracked using below path: https://paid25.saas.appdynamics.com/controller/#/location=AD_HOME

How to access Appdynamics:


 Login to AD using above path specified:
 Username:Pearson
 pwd:psn/snp

Page 156
 After successful login select the required application to monitor

Page 157
Key monitoring Metrics

 Application dashBoard-Summary
 Calls/Min
 Response time
 error %
 Stall#
 Application flow
 Business transactions
 Call Drill down-error details
 Remote service calls
 Database calls
 Metric Browser
 App Server
 -Individual nodes performance(memory/CPU/Network)

Please refer the link given below for more performance monitoring metrics for LST-
https://docs.google.com/spreadsheets/d/17dxRfzgnEccY6QiIOSOdctik99yfm6YNaWYYJBYS4-
s/edit#gid=1789151907

10. Performance Test Strategy


See below the Strategy template:

https://docs.google.com/document/d/1OgDmQ7GSt6OFbxekH8YmJ7Bf7DpWy5ij9_9mXVZeItA/edit

Sample below:

https://confluence.pearson.com/confluence/display/LTGPET/PSN11.1.0-Performance+Test+Strategy

Page 158

You might also like