Load Runner Materials
Load Runner Materials
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
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
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
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.
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):
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
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.
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.
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.
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.
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
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
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”.
Interview questions
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.
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:
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”.
(4TH) d
Page 17
3) Unique Each Iteration:
Every user has to pick “First Unused Data point”.
Users Data Point
e
f
Page 18
6) Unique Each Occurrence:
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.
8) Random Once:
Users Data Point
Page 19
9) Unique Once:
d
Note:
One to one mapping.
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.
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:
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
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.
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
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");
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
}
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?
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?
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,¶mlen,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.
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.
6. lr_save_string():
It assigns a value to LR variable
Ex: lr_save_string("abc","xyz");
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
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();
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
Web Functions:
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.
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();}
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.
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.
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”);
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
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
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
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);
}
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.
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().
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.
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);
}
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.
2. Script:
Script option will allow you to generate the auto think time, limits number of lines in a script.
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.
7. Advanced:
We can generate auto text verification function using this option.
We can generate auto headers.
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.
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.
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
Fiddler:
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.
CONTROLLER
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.
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.
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
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.
Runtime settings:
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.
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.
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.
5. ADDITIONAL ATTRIBUTES:
To declare the Environment variables.
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:
Automatic Transaction:
Allow you to generate the automatic transactions to measure the response time.
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
11. Preferences:
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.
Pacing Calculations:
(or)
Little’s Law:
(or)
How to calculate TPH (Transactions per hour)?
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
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
Formulae:
Pacing calculation P = R/I
P Pacing
R Remaining Time
I Number of iterations
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
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.
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.
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.
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.
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.
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.
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.
Advantages:
1. It is a web based application.
2. You can monitor the resources in b/w your team members.
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.
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.
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.
Types of testing
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
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.
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.
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.
9. Spike Test:
We have to test the application behavior under abnormal conditions.
Refer graph below
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
ANALYZER
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.
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.
7. Raw data: Based on the request we can pull the raw data and send to architecture people to
analysis purpose.
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.
Analysis Process:
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..).
Overlay graph:
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.
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.
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.
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”
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.
Overview Of JConsole:
2. JVisualVM:
JVisualVM is a default profiling tool for JVM. To leverage the services we have to install JDK.
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.
Overview Of JVisualVM:
Overview Of JMC:
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
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.
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.
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.
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.
In the next screen select either of “Use for Analysis” or “Use for Monitoring” as per
requirement.
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
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.
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
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.
It is also possible to generate graphs for various system resources consumption during the test.
Please read the below section on how to save/store the dynatrace sessions for a particular
duration at a shared location.
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.
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”.
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.
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”.
3. HP Shunra:
HP Shunra is created by Shunra, acquired by HP.
Steps:
Once the test is finished, filter the response times based on the response times and report the
same.
Open .lra file, filter the response times based on host names and report the same.
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.
Bottlenecks
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.
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
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.
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.
4
2
0
0 1 2 3 4 5 6 7
Elapsed Time
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.
Older Younger
Generation Generation
2 Eden 1 Survivor
Pools
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.
Note
By default, every thread privileged CPU time will be allocated.
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
Database bottlenecks:
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.
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.
Counters:
Buffer cached hit ratio.
Transactions for second.
Log cached hit ratio.
Page read per second.
Page writes per second.
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.
1. SAP_exit_sid
2. SAP_context_id
3. SAP_securid
4. Window_id
5. Event queue [WD1101]
Ex: windowed=144333121987
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:
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",
"",
"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);
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.
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.
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.
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);
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.
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.
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.
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.
web_reg_save_param_ex(
"ParamName=Web Service Response",
"LB=",
"RB=",
SEARCH_FILTERS,
LAST);
Note: Correlation, parameterization capturing and is same like web HTTP/HTML protocol.
(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.
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.
Enhancements:
To capture the dynamic value from the above request. We used below request
LAST);
Verification Points:
Lr_xml_find(“XML={response}”,
“value=name is”,
“query= //sendSMSresult”,
LAST);
Note:
Correlation we can capture the dynamic values with the help of lr_xml_get_values( ).
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.
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
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.
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:
FileNew ScriptChoose RTE protocol Start recordInvokes the terminal
Session choose communication tab click connect button provide session typeHost
name and port numberok
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.
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...
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
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.
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.
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:
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.
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.
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.
8. Stop developing
Click the Save button to save the script. Close the browser window. Restore the VuGen
window.
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
● 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.
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.
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.
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.
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.
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.
Options:
Locate. Locate the object. You will need to highlight the correct object in the application.
Cancel. Stop the replay.
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.
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.
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.
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);
AWR REPORTS
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.
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) 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.
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.
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.
f) Executive Summary
The SQE Performance Engineer will provide a report that summarizes the test results and
findings.
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.
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
What is JMeter?......................................................................................................................... 1
JMeter Features......................................................................................................................... 1
How JMeter Works? .................................................................................................................. 2
Controllers ............................................................................................................................... 13
Listeners .................................................................................................................................. 15
Timers ...................................................................................................................................... 15
Assertions ................................................................................................................................ 16
Configuration Elements........................................................................................................... 17
Pre-processor Elements ........................................................................................................... 18
Post-processor Elements .......................................................................................................... 18
x
5. JMETER ─ WEBTEST PLAN ................................................................................................... 20
xi
Write JMeter Test Plan ............................................................................................................ 65
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
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.
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
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.
Windows
Set the environment variable JAVA_HOME to C:\Program
Files\Java\jdk1.7.0_25
Windows
Append the string; C:\Program Files\Java\jdk1.7.0_25\bin to the end of the system variable,
Path.
9
JMeter
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.
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
Writing a TestPlan
Follow the steps given below to write a test plan:
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.
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
By default, JMeter does not save the element, you need to explicitly save it.
14
JMeter
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.
15
JMeter
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.
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
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)
Page 148
11. Click Review and 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
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.
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
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
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