Monday 8 October 2012

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 automation 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 main focus of Performance testing is checking a software program's to check or validate the application/products'

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.

 In general there are different types of performance testing. They're listed as below

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:

  1. Long Load Time.
  2. Poor response time.
  3. Bottle necking.
  4. Scalability. 
In market 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 will do. Coming to paid tools, they support all type of environments  where we can choose the required configuration as the price what you're paying for. 

LOAD RUNNER


 Why Load Runner??:
  1. Load Runner: One of the best automated performance testing tool.
  2. Uses ANSI C as the default programming language and other languages like Java and VB.
  3. No need to install it on the server under test. It uses native monitors.
  4.  Supports all types of protocols (HTTP, FTP and SMTP).
  5.  Easy to analyze the results and creating scripts.
 
As we know Load Runner was acquired by Hewlett-Packard organization. One of the best and most used tool by many 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 the Load Runner , the best process to follow is :

The above model is the best model to follow for the performance test.

Let's discuss much about the tool now.There are main 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 the 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, users 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.
     
          Load runner supports scripting languages like ANSI C, VB Script, JAVA etc.. C and VB scripting are the most used ones in load runner. In recent versions of load runner JAVA scripting has been implemented, which can be widely used.

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  (VuGen) will be able to record the scripts from the application. User can record the application script.
 
  1. Launch Load Runner-> Select record or create script. 
  2. Select New Vuser Script-> Select Next. 
  3. Select the needed protocol (Supports multiple and single protocols) -> Click OK. 
  4. Select ‘Tools’ from menu bar ->Recording Options-> Under Recording options Select ‘Recording’ 
  5. Select the particular protocol type and script types (with or without user actions i.e. only URL’s) 
  6. Select ‘start Recording’ under menu pane.
  7. Enter the website on the dialog box-> Select ‘OK’. 
  8. Perform the actions on the website opened.
  9. Automatic script creation will be done in load runner.
  10. End of Script creation. 
Note: Steps might differ w.r.t the tool version.
           With the user script created, we can parametrize the  recorded script. Parameterisation helps us to create different actions for different Vusers which will be allocated in run-time settings.

          Really confused about parameterisation? Don't worry I'll make it simple with the general example. In general, when we record the scenario with values A,B,C...the script contains the same values and when we want to change to 1,2,3...again we need to record the script. Instead of recording the script again and again for different values, we will parameterize the values with the required ones.

Parameterisation:

         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 parameterisation..
 
Watch the video for more info regarding parameterisation, might be in depth in concept wise, can be understood easily: https://www.youtube.com/watch?v=Ebcw9x15Vrs

Process to parameterize:

  1. Right click on the appropriate parameters in the script.
  2. Select replace parameters.
  3. The parameter name must be generic(the parameter naming is user-defined and named as per ease of use) as per the application defined.
  4. Insert with respective parameters in the parameters window.
  5. Select ‘OK’.
       Note: Steps might differ w.r.t the tool version.

Before running the scripts, user can change the run time settings as per the modified script with respect to the number of iterations.


enu->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:

  1. File 
  2. Table
  3. XML
  4. Random Number
  5. Iteration Number
  6. Unique Number
  7. Load generator Name
  8. Date/Time
  9. Vuser ID
  10. User-Defined parameter.
The above are the types of parameter files we can use in Load Runner. Let's see in-depth about types. Maximum parameterization will be done with File, XML and Table parameters.

File and Table:

          This is 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:

            The 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.

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.


For example, you need to see the 50 transactions which are happened in your application. By giving respective incident IDs(range: Min-Max) you can get the transaction and can run the situation.



Iteration Number:
As the name says Iterate, the current iteration number will be replaced with the Vuser parameter.

Unique Number:

Unique, with this parameter we can insert a single and unique parameter by specifying its Range.

For example if you want to get the data for employee number from 99-101, just insert the number and run it. We can get the required data.

Load Generator Name:

It's one of the best parameter while we are running Vusers in larger numbers. While execution it just replaces the current parameter with the name of the Vuser script’s load generator. It will make things simple to find the failure while analyzing.

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.

Applications which use Date/Time as the main asset, this parameter is very useful.

There are many more parameter types which can be observed while practicing the tool.

Will update the more info regarding load runner soon.. :-)