Sunday, July 22, 2012

Introduction to Loadrunner (for beginners)

Loadrunner (mostly known as LR) is a kind of software that helps you test your applications from the perspective of performance, stress and load.
The software consists of 3 main applications:

  • Vugen: With this application you record, parametrize and verify your scripts (does not require license).
  • Controller: By using Controller you create Load Test Scenarios by making use of the scripts you've already created (license is required).
  • Analysis: After running the load test you need to anayse the results. By using Analysis tool you can check the run result reports (does not require license).
What you do with LR is basically like following:
This is just a brief explanation, details of each step will be posted when i am available.
  1. Create your manual testcases and scenarios (from QC is optional).
    Right click on design step and select Generate Script -> Vugen

  2. Optionally convert them to LR scripts.
  3. Open the test script by using Vugen (Vugen -QC connectivity described here).
  4. Click Record button. For the recording options generally i am using following settings.
    My preferred recording options for HTML/HTTP protocol

  5. While recording do not forget to add "Start Transaction" and "End Transaction" flags. The transaction markers are very important while running the real test. Because LR Controller is going to measure elapsed times of the transactions. If you do not set them correctly you won't be able to render the results correctly.
    Label the user actions by using Start-End Transaction
    A small part of the generated script
  6. After recording of the scenario finishes you have to verify it by pressing F5. After execution of the script you recorded completes successfully. You can progress to the LR Controller part. If the replay fails you need to open the Tree View and compare the recorded and replayed requests and responses. And try to find on which request the problem is.
  7. When everything is OK about the LR Script open the LR Controller application and create new scenario by selecting Manual Scenario and adding the script that you saved with Vugen.
  8. In the Design tab of the Controller you can set number of users, their ramp up and ramp down setings and how much time you want to run the test, etc...
  9. When the load test completes you can open the result with Analysis and check the execution time of each transactions and impact of the quantity of the virtual users to the transaction times.