HP LoadRunner


HP LoadRunner
Loadrunner is comprised with below 4 components
Ø  Virtual User Generator (VUGen)
Ø  Controller
Ø  Analysis
Ø  Load Generator
Of these VUGen, Controller and Analysis is installed generally on the same machine and Load generator is installed on a separate machine.




Virtual User Generator (VUGen)
Virtual User Generator enables us to develop VUser scripts for a variety of application types and communication protocols. VUser performs action of real-time users by performing typical business processes in the application. This helps us to emulate real world situation. Single workstation can accommodate only single human user, but using VUser script we can run many VUsers concurrently on a single workstation. The action that a VUser performs is described in a VUser script. For each action a VUser performs, the controller submits input to a server.
Below are the steps we need to follow before we execute the test in Controller.




Creating a VUser Script

To create a new Vuser Script please follow the steps mentioned below.
1. Select Start ->Programs->LoadRunner->Virtual User Generator
Then VuGen MainWindow opens.
2.  Select File -> New or Click on New Button then the following screen will be displayed.
     Loadrunner gives you a list of protocols that Loadrunner supports. Default option is HTML/HTTP   protocol.



On selecting the protocol, Loadrunner will direct you to the area where the application is recorded. It is shown in the below screenshot.

A script has 3 sections.
VUser_Init()
Used basically to logging into the application.

Action()
Core part of the script where the actual transactions are recorded

VUser_End()
Used mostly to record the logout transaction
Now click on the record button as shown below.
You will see the below dialogue box when you click on Record.
In the above box enter the URL of the application. Stick to the default settings under Options unless you want to change the settings for some particular need. Click on OK button and record the complete flow that you want.

Transactions
Transactions are inserted into the script in order to measure the performance of an action.


Transactions are the starting and ending point of any user action

lr_start_transaction("Login");

// User Activity would be recorded here.
               
lr_end_transaction("Login",LR_AUTO);

During recording of a script we start a transaction with name="Login" then perform the Login activity on the application and after completion of login activity we click on end Transaction Button.
transactions are mainly used for measuring the time taken for any specific activity i.e. Login in above case.

lr_start_transaction ( const char *transaction_name );
Marks the beginning of a transaction. 

lr_end_transaction (const char *transaction_name, int status ) ;
Marks the ending of a transaction.
Note:- Name of the transaction in both start and end should be same otherwise LR will throw an error.

You can manually set the status of any transaction using status attribute.
LR_PASS :- For Success
LR_FAIL:- For Failure
LR_AUTO :- Value will be automatically assigned by Loadrunner
LR_STOP  :- For Aborted

Example:-  In the following example the user open a link "www.xyz.com" . If the link open successfully the transaction is marked with pass else fail.


lr_start_transaction("Open_Link");

rc = web_url("www.xyz.com",
                 "URL=http://www.xyz.com/",
                 "Mode=HTML",
                 LAST);

/* End transaction with operation result - pass or fail */
if (rc == 0)

    lr_end_transaction("Open_Link", LR_PASS);

else
    lr_end_transaction("Open_Link", LR_FAIL);

Comments

Popular posts from this blog

Neo Load Performance testing Tool

Loadrunner Functions

Analyzer in LoadRunner Part 2