How to use Controller in Loadrunner?

The Controller in HP LoadRunner is used to control the overall execution of the load test scripts. In this tool you can decide which test scripts need to run, the number of users that need to run against script and a lot more. This section of the tutorial will focus more on how you can use the Controller to control the load test.

In this tutorial, you will learn:

  1. How to use the controller
  2. How to customize a load test
  3. How to create a Goal Oriented scenario

Starting the controller

When the HP LoadRunner is installed, you can see the Controller icon as part of the installation.controller_icon_loadrunner_controller_tutorial

Double click the Controller to start the application. When the application launches, you will initially get a dialog box to create a new scenario. For now you can click on the Cancel button on this dialog box.new_scenario_loadrunner_controller_tutorial

You will finally get the Controller interface as shown belowcontroller_interface_loadrunner_controller_tutorial

Now click on the File menu > New option to create a new scenario.file-scenario_loadrunner_controller_tutorial

In the next dialog box you can now create a scenario.

create_scenario_loadrunner_controller_tutorial

  1. Let’s start with the manual scenario which helps the user understand better how to use the controller. The manual scenario will allow you to manage your load test settings by yourself.
  2. Choose the WebToursScript, which is the script which was created in the VUGEN editor.
  3. Click on the Add button to add the script to our scenario. Then click on the OK button to proceed.

You will now be presented with the below screen which gives the entire aspects of the load test.complete_scenario_loadrunner_controller_tutorial

Let’s conduct our first test run to see what happens. But before we do that , let’s quickly look at some basic settings which are put by default for our load test.first_run_settings_loadrunner_controller_tutorial

  1. We can see that our script is loaded as webtoursscript, which is correct. It has a quantity.
  2. It has a quantity of 10. This means that a total of 10 users will be hit against our Web tours application in this load test.
  3. There are some additional settings in the Global Schedule such as the how many users should be scaled up during a specific time interval. You should ideally never launch all your virtual users at one time. There should be a gradual increase of virtual users against a system. So in our case, there is a setting put in place which says that the users should be incremented by 2 users every 15 seconds.
  4. Finally we have the specified duration for the entire load test, which is 5 minutes.

So let’s run the test and see what happens. To initiate the test, you need to click the Run button as shown below.run_button_loadrunner_controller_tutorial

When the load test is run, you will get the below Run window.load_test_run_loadrunner_controller_tutorial

Let’s go through the major features of each aspect of the above run window.

  • Scenario Groups – In the Scenario Group, one of the major aspects you will see is the running of the Virtual Users. The below screenshot is taken when the load test is initiated. You will notice the value of Run is 2 and the value of Down is 8. This means that at this point in the test, there are 2 virtual users running, and 8 which are still pending to be initiated. Remember that this is based on our schedule which clearly states that 2 users should be incremented in batches of 2 every 15 seconds.scenario_groups_loadrunner_controller_tutorial
  • Scenario Status – In this screen you can see the following points
    1. The number of virtual users running at any point in time
    2. The elapsed time of the load test
    3. The number of web page hits per second
    4. The number of passed and failed transactions
    5. The number of errors in the test
    6. The ability to stop the load test at any point in time.

    scenario_status_loadrunner_controller_tutorialIf you click on the Errors or Failed transactions icon, you will actually be able to see the Errors and failed transactions per users during the load test. An example screenshot of both of these screens are shown below.

    Screenshot of Failed Transactionsfailed_transactions_loadrunner_controller_tutorial

    Screenshot of Errorserrors_loadrunner_controller_tutorial

    In the Error screen, you will actually be able to see details of the errors.

  • Graphs – You have the ability to view various graphs to see the status of the load test. The below graphs shows the number of users running per elapsed time and the number of hits per second.graphs_loadrunner_controller_tutorial

How to customize a load test

Now let’s look at the different things we can do to customize our load test.

Adding a virtual user group

Remember that the controller can be used to manage many load test scripts at the same time. So supposed if we wanted to add another load test script to our Controller. We can do this by clicking on the Add virtual user option as shown below.add_virtual_user_group_loadrunner_controller_tutorial

  • You will then be presented with the below dialog box to add the load test scripts to the Controller.add_group_loadrunner_controller_tutorial
    1. Give the group a name. The group name will be auto populated with the script name once it is chosen.
    2. We then give the number of users that should run against the load test script. Remember that in the community edition you have a maximum of 50 virtual users.
    3. Choose the script which needs to be added to the load test.
  • Once you click the OK button, the load test script will be loaded in the Design screen.add_load_test_script_loadrunner_controller_tutorial

Change the Schedule actions

Obviously one would also have the option to change the way the users are launched against the application in the schedule. You can very easily change the schedule actions.

For this, You first need to choose the desired action to be changed. Then click on the Edit schedule option as shown below.change_schedule_loadrunner_controller_tutorial

You will then be presented with a dialog box in which you can change the desired values accordingly.change_schedule_dialog_loadrunner_controller_tutorial

Adding Service Level Agreements

Next you also have the option to add service level agreements. These are metrics which are monitored during the load test and to which the load test must adhere to. To create a new SLA, just click on the ‘New’ button.sla_loadrunner_controller_tutorial

You will then be presented with a Wizard which will assist in the SLA definition process. In the first screen, click the Next button to proceed.sla_goal_definition_loadrunner_controller_tutorial

In the next screen, you will give options as what the SLA should be based upon. For the purpose of our example, we can take the case for a percentile SLA. This SLA means that the transaction’s response time during the load test should meet a defined SLA.sla_goal_loadrunner_controller_tutorial

Click the Next button to proceed.

In the next screen you will asked to select the transactions which should be monitored. We will choose our chk_login checkpoint which is used for the login process in our Web tours application.sal_select_transactions_loadrunner_controller_tutorial

Click the Next button to proceed. In the next screen, you are actually defining that 90% of the chk_login transactions should be of a threshold of 2 seconds.sla_percentile_loadrunner_controller_tutorial

You will now see that the SLA has been defined in the Controller.sla_defined_loadrunner_controller_tutorial

How to create a Goal Oriented scenario

We have seen what goes into creating a manual scenario, let’s see what goes into creating a goal oriented scenario.

Choose the Menu option of File > New in the controller. You will then be presented with the below dialog boxhow_to_create_goal_oriented_scenario_loadrunner_controller_tutorial

  1. This time choose the option of Goal-oriented scenario.
  2. Choose the WebHttpHtml2 or any script you want.
  3. Click the Add button to add the script to the load test.

Click the OK button to create the test. You will then be presented with the below Design screen in the Controller.goal_oriented_design_loadrunner_controller_tutorial

Let’s go through some of the Key aspects in the Goal oriented scenario.

  • The goal itself – Goal oriented scenarios are based on a goal which is decided by LoadRunner.goal_loadrunner_controller_tutorial
  • Adding scripts on the fly – The first you notice is that you can add scripts on the fly by just clicking on the drop down box on the Script Name and then choosing the desired script.goal_oriented_adding_scripts_loadrunner_controller_tutorial
  • Generators – Load Generators are used to create local environments that can be used to launch the virtual users. You can create Generators by clicking on the Generators button.goal_oriented_generators_loadrunner_controller_tutorial

You will then be presented with the Load Generator screen. Click the Add button to add a new Load Generator.add_new_load_generator_loadrunner_controller_tutorial

  1. Give a name for the Load generator. Specify the platform the load generator will run in. Provide a temporary directory which will be used by the load generator.
  2. Click the More button to specify further options for the Load generator.

In the Runtime Quota tab, you will see the limit of 50 virtual users which can run on the machine.load_generator_runtime_quota_loadrunner_controller_tutorial

The VUser limits screen has the maximum number of possible GUI and terminal users that can run on the machine.load_generator_vulimit_loadrunner_controller_tutorial

Once you define the load generator, ensure to click the Connect button to connect to the load generator. The Status of the load generator will then turn to Ready as shown in the screenshot. load_generator_ready_loadrunner_controller_tutorial

To start the load test, click the Start Scenario button.goal_scenario_run_scenario_loadrunner_controller_tutorial

When you run the Goal scenario, you will get the similar run screen which is present when running a manual scenario. A snapshot of the run is shown below.goal_scenario_run_loadrunner_controller_tutorial

In our next topic we will learn how to use Analysis in LoadRunner?