Pages

Monday, 22 September 2014

Load Runner for Beginners




Hi Guys..

Here's a new way to learn load runner easily. Basically I worked on 9.0 version. So, Here are the basic concepts of the load runner which are helpful for beginners.

Basically Load Runner is automated performance tool which comes under performance testing.
Let's see what is performance testing and what we do in performance testing.

Performance Testing:
Performance testing will be done to ensure that there are no performance related risks at the time of production or live environment. It's a means of Quality Assurance.

The focus of Performance testing is checking a software program's



·   Speed:       Determines whether the application responds quickly.

·  Scalability:  Determines maximum user load the software application can handle.

·  Stability:      Determines if the application is stable under varying loads.

 There are different types of performance testing. They're

Load Testing: checks the application’s ability to perform under anticipated user loads. The objective is to identify performance bottlenecks before the software application goes live.

Stress Testing: involves testing an application under extreme workloads to see how it handles high traffic or data processing .The objective is to identify breaking point of an application.

Endurance Testing: is done to make sure the software can handle the expected load over a long period of time.

Spike Testing: tests the software’s reaction to sudden large spikes in the load generated by users. The best example for spike testing is train reservation during tatkal time.

Scalability Testing: The objective of scalability testing is to determine the software application’s effectiveness in “scaling up” to support an increase in user load. It helps plan capacity addition to your software system.

Volume Testing: Under Volume Testing large no. of. Data is populated in database and the overall software system’s behavior is monitored. The objective is to check software application’s performance under varying database volumes
 Common Performance Problems:

    Long Load Time.
    Poor response time.
    Bottle necking.
    Scalability.

There are different types of performance testing tools

    Load runner
     J Meter
    Open STA
    Neo Load
     Open Load
    Load Impact

The above are the mostly used automation tools in most of the organizations. Some are free to use and some are paid. The major difference between free and paid tools is some free tools won't support all types of environments and some do. Coming to paid tools, they support all type of environments with respective number of Vusers as per the price what you're paying for.
LOAD RUNNER

 Why Load Runner:

    Load Runner: One of the best automated performance testing tool.
    Uses ANSI C as the default programming language and other languages like Java and VB.
    No need to install it on the server under test. It uses native monitors.
     Supports all types of protocols (HTTP, FTP and SMTP).
     Easy to analyze the results and creating scripts.


As we know Load Runner was invented by Hewlett-Packard organization. One of the best and most used tool by the organizations. Though it's a paid tool, for perfect and easiness in use this tool is the best.

For every tool, there is a testing process to test an application. For Load Runner tool, the best process to follow is :

The above model is the best model to follow to perform a performance test.
Let's discuss much about the tool.
 There are different components of Load Runner. They' are


Components of Load Runner:

1) Vuser Generator
2) Controller
3) Analyzer

Let's discuss about each component briefly with related examples.
VUser Generator:
The first component and the basic component is "Vuser Generator". In Load Runner tool humans are replaced by Vusers who are replica of humans. More number of Vusers can be worked on a single work station with different scenarios. Load runner can accommodate hundreds or even thousands of Vusers with different scenarios.
With the help of Vuser script, Vusers can perform the tests. User can record and playback the application for script generation.
By modification or editing the scripts, user can create different scenarios for different Vusers. With this load test can be made simple and easy with one workstation.

Controller:
In Load Runner ‘Controller’ is used to control the VUsers with single work station with different scenarios assigned to VUsers.
Analysis:
After the performance test the user can view the results of the test in graphs.

More into the concepts of Load Runner. As we discussed, we start with 'Vuser Generator'.

Vuser scripts are created by Virtual User Generator with the recording of activities between client and server. It records the scripts. These scripts are used to emulate the steps of real human users. Using Vugen, we can also run the scripts for debugging.
VuGen can be used for recording in windows platforms. But, a recorded Vuser script can also be run on Unix platform.

Developing Vuser Script is a five step process:

    Record a Vuser script
    Vuser Script Enhancement – by adding the control statements and other functions
    Run time Settings Configuration
    Running of Vuser Script on Stand Alone machine – Verify that the script runs correctly
    Integration of Vuser Script – into a LoadRunner scenario or Performance Center or Tuning module session or Business process monitor profile etc.


Steps to create scripts:

Vuser generator will be able to record the scripts from the application. User can record the application script.


    Launch Load Runner-> Select record or create script.
    Select New Vuser Script-> Select Next.
    Select the needed protocol (Supports multiple and single protocols) -> Click OK.
    Select ‘Tools’ from menu bar ->Recording Options-> Under Recording options Select ‘Recording’
    Select the particular protocol type and script types (with or without user actions i.e. only URL’s)
    Select ‘start Recording’ under menu pane.
    Enter the website on the dialog box-> Select ‘OK’.
    Perform the actions on the website opened.
    Automatic script creation will be done in load runner.
    End of Script creation.

With the user script created, we can parametrize the  recorded script. Parametrization helps us to create different actions for different Vusers which will be allocated in run-time settings.




Parameterization:
User can parameterize the created script with respective parameters in the application. Major advantage of load runner is that the user can insert any number of parameters in to the script with respect to application.
Watch this tutorial for more info on parametrization
.

Process to parametrize:

    Right click on the appropriate parameters in the script.
    Select replace parameters.
    The parameter name must be generic(the parameter naming is user-defined and named as per ease of use) as per the application defined.
    Insert with respective parameters in the parameters window.
    Select ‘OK’.


Before running the scripts, user has to change the runtime settings as per the modified script and with respect to the number of iterations.
Menu->View->run time settings-> change the settings as per the requirements.
There are few ways to adopt a parameter and as per the availability we can assign the type of the parameter to it.
Types of Parameters:

    File
    Table
     XML
     Random Number
     Iteration Number
     Unique Number
     Load generator Name
     Date/Time
    Vuser ID
    User-Defined parameter.



The above are the types of parameter files we can use in Load Runner. Let's see in-depth about types.


File and Table:
These are the most widely used parameter types in the performance testing domain. Vusers take value from the data file and table.
When a file type or table type parameter is used, a .dat file is created. By default all the data files are named as <Parameter Name>.dat and are stored in the script’s directory.
When VuGen opens the data file, it displays the first 100 rows. To view all of the data, click ‘Edit with Notepad’ and view the data in ‘parameter properties’.

 XML type parameters:
XML Parameter Types are used for multiple valued data contained in an XML structure. It replaces a complex structure in which an array can be made a part of another array.
The complex structure as required in a web-service call can be replaced with a single XML parameter.
E.g., An XML parameter by the name Contact can replace a name, email id, mobile number, and address.
XML parameterization helps to have cleaner input of the data, and enables efficient parameterization of Vuser scripts. XML parameters are widely used with Web Service scripts and with SOA services.

Random Number:
Random Number replaces the parameter with a random number. While creating random type parameter, a minimum and maximum value of the range (the range, out of which the random number is planned to be selected) is required to be set.
A Random type parameter can be used -
·                                 To sample a system’s behavior within a possible range of values. E.g. To randomly view the details of 50 incidents being created in the system, one can specify the range for 50 serial incident ids (e.g., Min – 40001, Max - 40050) and emulate the situation. Randomly incident details will be viewed by Vusers.

·                                 Percentage distribution of tasks’ execution by Vusers. Random number can be set to have a range of 100. Using if loop one can achieve appropriate percentage distribution of different tasks.

Iteration Number:

Iteration number parameter type replaces the parameter name with Vuser’s current iteration number.
An iteration type parameter can be used -
·                                 To print the Vuser’s iteration number in external file as sometimes required while debugging scripts for data-issues.
·                                 To allocate a unique data input per Vuser.


 Unique Number:
Unique number parameter replaces the parameter with a unique value. This value is taken from the range set by entering the start value and the size of the range.
Unique number type of parameter is used -
·                                 To enter a unique value in the data field while script execution. (E.g. setting a unique username for a Signup transaction of a website).

·                                 To check system’s behavior for all possible values of the parameter.
E.g., Executing a query for all employees, whose ID numbers range from 100 through 199, create 100 Vusers and set the start number to 100 and block size to 100.
 
LoadGenerator Name:
A LoadGenerator is the machine on which Vusers perform the steps as in the scripts. During test execution, Load Generator Name type parameter replaces the parameter with the name of the Vuser script’s load generator.
A LoadGenerator type of parameter is used -
·                                 While debugging scripts, to understand if failures exist only at a particular loadgenerator.
·                                 To segregate results and logs between different loadgenerators.

Date/Time parameter type:
A Date/time parameter replaces the parameter with a date and/or time. One can specify one’s own format of date/time representation.
Date/time parameter type is used in -
·                                 Business scenarios in which vuser wants to get specific details for specific duration of time. In the form data, the ‘from’ field-type will have value of last month’s date-time and the ‘to’ field will have date/time of current date-time.
·                                 Scenarios in which vuser has to enter a date-time value.
·                                 Scenarios in which vusers have to enter a unique string value for a field.

Vuser Id parameter type:
A Vuser ID replaces the parameter with the ID number assigned to the Vuser by the Controller during a scenario run. When you run a script from VuGen, the Vuser ID is always 1.
Vuser id parameter type is used -
·                                 To print the vuser id in an external file for script-debugging purpose.
·                                 To segregate transaction volume based on Vuser ids.

 User defined parameter type:
A User defined parameter type is a user-defined function in which call to the function is made and the value returned by the function replaces the parameter name.
This type of parameter is used in following cases -
·                                 Random function can be called to capture one out of the many co-related values stored in an array (created by web_reg_save_param).
·                                 To obtain a value in a specific format that is not supported by other parameter types.

We can observe while recording a script , a window with some buttons will be displayed. Which contains vuser_init, action,vuser_end. These are the options which are useful for the user at the time of recording script.

Like generally,
What is the purpose of vuser_init action in LoadRunner?
Vuser_init action contains details of procedures to login to a server.


With this the parametrization of script will be done to allocate to different Vusers.


CATCH ME

No comments: