Vuser Scripting

The following blog article will guide and help the users in creation of Vuser scripts in LoadRunner

  • Open Virtual user generator.
  • Select file-> new script and solution and name it accordingly. From the protocol portion select web-http/html. Press Create.
  • Now the actions will be recorded for the generation of the script. To start recording press the red circular button from the menu bar. In the start recording window enter the url of the website.
  • Change the application to record to Google Chrome or any browser present in your machine. Press Start recording.
  • Different functions of the website like login, browsing different links, search, logout etc. After the browsing is over stop the recording.
  • LoadRunner will automatically create a script for you and search for the dynamic variables like cookies, session id etc that change every time we connect with the website. It will show all those variables that should be correlated to make script run without any errors.
  • Design studio box list does values and will ask whether we want to perform correlation. Click Correlate button.Correlation will be performed and the dynamic values will be replaced with parameters.
  • You can also create a rendezvous point where you want every vuser to meet there and then proceed further. Right click before the action where you want to perform rendezvous and select insert->rendezvous and name it.
  • One can also create a transaction for the functions which are very important from the functionality point of view. Select the place you want to start transaction. Right click select Insert->Start transaction. Then name your transaction by writing the name within the double quotes provided. Again when you want to end the transaction right click and select Insert->End transaction and then write the name of the transaction you are ending.
  • While logging a username and password is used, to parameterise them to make it dynamic, search for the username and password in the script. Select the value and right click select replace with parameter->create new parameter.
  • In the select or create parameter box write the name of the parameter and select the type of the parameter. Now click on properties. If File is selected you will see a table with one row and column with the value equal to the value used during login. We can add more values by adding new row. Now click close and then OK.
  • Do it similarly for the password or any other values like search term etc.
  • Now replay the script by clicking the green play button. If the script gets passed it means it is error free, you can proceed further else search for the errors and fix them and again replay the script.

Thus in this way we create scripts and modify it with correlated parameters, rendezvous, transactions and user based parameters.

Advertisements

List Of LoadRunner Books:

LoadRunner Books for reference:

1) Performance & Load Testing

2) An Introduction to LoadRunner – A Powerful Performance Testing Tool by HP

3) Let us Learn & Master LoadRunner 9.0

4) Load Test Planning – Especially with LoadRunner

5) Understanding of Load Testing Tools – Especially HP LoadRunner

6) Introduction to HP LoadRunner

7) Building Scripts for LoadRunner

8) Configuration of Run Time Settings for HP LoadRunner

9) Playing Back Scripts in HP LoadRunner

10) Parameterization – Advanced VUser Scripts in HP LoadRunner

11) Enhancing Vuser Scripts in HP LoadRunner

12) Understanding Correlation in HP LoadRunner

13) How to design a Scenario in HP LoadRunner

14) How to Run a Scenario in HP LoadRunner

15) How to do Analysis in HP LoadRunner

16) Understanding Performance testing – The Performance Testing Tool

17) Understanding Analysis Reports in HP LoadRunner

 

 

HP Loadrunner Introduction

HP Loadrunner is a famous tool for performance testing.It stresses your application to desired limits and identifies potential and problematic bottlenecks in client,network or server.

Loadrunner addresses the above issues in following ways :-

  • It has Vusers which act as virtual users and emulate the actions performed by different real users.As multiple vusers run on the same machine it evens helps in curbing the cost of hardware required.
  • Loadrunner Controller helps in controlling all of the vusers from a single point, thus helping the engineer in controlling the activities in an efficient way.
  • LoadRunner monitors the application performance online, enabling you to fine- tune your system during test execution.
  • It automatically records the performance result of the application. It has wide varieties of results to choose from,as required by the engineer.
  • LoadRunner monitors the network and server resources to help you improve performance.
  • As all of the tests are automated these can be saved and run again and again as and when required.

Common Errors While Using Loadrunner

  1. Error -10343: Communication error: Failed to connect to remote host

Solution:

Make sure that you apply the same LoadRunner version and Service Pack on the Controller and Load Generator machines.

Make sure that you can ping the Controller and host machine bidirectionally. You may need to add the IP address and machine name on the host file

  1. Error -29989: Process “lr_bridge.exe” was not created on remote host , reason – communication error.

Solution:

The LoadRunner Agent Process is trying to connect through a port that is busy .LoadRunner Agent Process/service starts itself at port 50500 and 54345 (For monitoring/running vuser over firewall, it is port 443). Do a netstat -an on the machine and check to see if 54345 and 50500 are occupied. If these ports are in used when you start the agent, you will get the above error.

  1. Error -10344: Communication error: Failed to bind socket. A process on the machine is already bound to the same address.

Solution:

You may also get this error during replay if LoadRunner agent of the host machine is connecting back to the controller using a port that is already bound.

  1. ERROR -29987: Process “traceroute_server.exe was not created…” when connecting to a remote host.

Solution:

verify that you are able to ping back and forth between the controller and the load generator machines using both host names as well as ip addresses..

Add the host name and ip address of load generator to the hosts file on the controller. Add the host name and ip address of the controller to the hosts file on the load generator

5.Error -30932: “Failed to open eve file

The Load Generator files may be specified in the Controller options to be shared on a network drive, but they are being saved on a local drive. To check this, in the Controller go to Tools -> Options -> RunTime File Storage and select the “On the current Vuser machine” option