Saturday, October 19, 2013

Important concepts in load runner scripting

To perfect in loadrunner scripting please go through with the below concepts .
Guide lines for performance scripting.
1) Under stand the  HTTP Request and Response.
2)  Record the script in Action Method.
3) disable all the script level properties.
4) Always better to record the script in HTML page with 'A script containing explicit URL only' by selecting this option under Advance HTML.
5) Always enable "Generate web_reg_find function for page titles" in advance properties.
6) Select "Enable the correlation during recording" option in correlation properties if you want to do automatic correlation.
7) Insert the transaction points for each page request to measure the response time.

HTTP Request and Response:

First need to understand the request and response  from client to server.
An HTTP request will be sent from browser to server.
Generally most useful methods in loadrunner are get and post

Get method :
Get method is used to Requests data from a specified resource

Example :accessing gmail application from browser,every one will have the same login page and we will get that using Get method

Post Method:
post method Submits data to be processed to a specified resource

Example :The transaction id generating from server which is different for every user and we can get from Post method.

In loadrunner get method is replaced with web_url and Post method is replaced with web_submit_data


There are different tools available in the market to analyze the HTTP traffic, those are
1) Firefox-HTTPfox
2) IE-HTTPwatch
3) Fiddler and etc..

Record the script in Action Method:
Record the script in Action Method including login and logout for quick recording later if we want we can split the login and logout  functions in other block  and we can call  those functions wherever required.

Disable the script level properties:

I will update the steps to right load runner script manually without recording

Transaction Points:










Thursday, October 3, 2013

Start Learning Load Runner

Load Runner is performance tool best suitable for maximum no.of protocols.
current version is 11.5 Owned by HP and called as HP load runner and prior to this it is with mercury.

Components of Load Runner:
1) Virtual User Generator
2) Load Generator 
3) Controller
4) Analysis

 Virtual User Generator :
Component is used to develop and customize the Vuser script based upon identified business scenario.
and based on identified scenario we will generate vuser's script and also costomize it with all the scripting scenario standard's to make sure the script will reply according to the vuser's behavior.
Installation file for vugen is vugen.exe

Controller :
This component is used to organize, drive, manage, and also monitor the multiple user test scenario as per the plan.
Installation file for controller is wlrun.exe and windows flavor supported

Analysis:
This  component is used to view, compare and analyze the result with graphs and statistical summery report.we can analize based on SLA's which have.
All the flavors of windows and Linux will be supported

Agent Process:
It is communicator between load generator and load controller.
Installation file for agent process is magentproc.exe.
All the flavors of windows, Linux  and Unix.

Note:
When we install agent process in machine then  that machine will acts like load generator.

Load Generator:
Will generator will generate the amount of load (virtual users ) and will hit the server.


Protocol adviser:
A Newly add feature available from LR 9.5 version and it detects the best suitable protocol to automate the script.

Usage
By selecting protocol adviser navigate any on of the end to end business scenario.this way the protocol adviser will walk through application communication and development technologies and identifies the supported protocols.
But Prior to this thing need to be done manually.

Load runner testing process:
Below are the steps involved in load runner testing process
1) Plan the load test
2) Convert business scenario into vusers script
3) Define the scenario
4) Execute/Run the defined scenario
5) Analyze the scenario.

In stall load runner trail version in your machine to start learning the script.
Options and steps while doing scripting

generally script is divided in to 3 parts:

1) vuser init():
2) Action();
3) vuser end();









Tuesday, October 1, 2013

Basic Load Runner functions

Below are few frequently used LR functions

1) lr_ouput_message()
2)  lr_message()
3) lr_error_message()
4) lr_log_message()
5) lr_save_datetime()
6) lr_save_string()
7) lr_save_int()
8) lr_eval_string

LR_OUTPUT_MESSAGE()
This function is used to display the  message in an output window.

Example program to demonstrate

Action()
{
lr_output_message("Welcome to load runner")
}

Output: Action.(3):Welcome to load runner

Note:-If u want to see only message without logs then go to Run Time Settings and disable logs

To display the message (which is stored in a variable)
Action()
{
char *temp="Hyderabad";

lr_output_message("%s",temp);
return 0;
}

Output:Action.(5):Welcome to load runner

Note:- If u want to ignore the line numbers then use lr_message instead of lr_output_message

Action()
{
char *temp="Hyderabad";

lr_message("%s",temp);
return 0;
}
Output:Welcome to load runner

LR_LOG_Message():-
This function is used to display a log message .It will writes the log message in to log file.

Action()
{
char *temp="Hyderabad";

lr_log_message("%s",temp);
return 0;
}
Output:Welcome to load runner

Note: To enable logs go to Run Time Settings and enable logs and log messages will be saved into log file during the test execution in controller.

LR_SAVE_DATETIME():
It captures and saves the system's current date and time.
below are the few keywords which are used in lr_save_datetime

a----------------------------------->day with a part of name
A---------------------------------->Full name of the day.
b----------------------------------->name of the month(only a part of the month name)
B----------------------------------->Full name of the month
#----------------------------------->Will ignores 0 in the month
%d--------------------------------->To display the day in digits
%m--------------------------------->To display the month in digits
%M--------------------------------->To display the minutes
%y----------------------------------->displays year but contains only 2 digits
%Y---------------------------------->displays year but contains 4 digits
%c-----------------------------------> system current time along with time
date_now
A system keyword to captures the today's date

Action()
{
lr_save_datetime("%c",date_now,"abc");
lr_output_message(lr_eval_string("{abc}"));
return 0;
}

LR_SAVE_STRING():
This function is used to save the string value into another string variable

Action()
{
lr_save_string("welcome to load runner","abc");
lr_output_message(lr_eval_string("{abc}"));
return 0;
}

Action()
{
char *temp="welcome to load runner";
lr_save_string(temp,"abc");
lr_output_message(lr_eval_string("{abc}"));
return 0;
}

Note:
lr_save_string canot save the int values in to string variable

LR_SAVE_INT():
This function is used to save the int value into another string variable

Action()
{
lr_save_int(1213123,"abc");
lr_output_message(lr_eval_string("{abc}"));
return 0;
}

Action()
{
int i=1213123;
lr_save_int(i,"abc");
lr_output_message(lr_eval_string("{abc}"));
return 0;
}

Note:
lr_save_string canot save the int values in to string variable