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:
When the HP LoadRunner is installed, you can see the Controller icon as part of the installation.
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.
You will finally get the Controller interface as shown below
Now click on the File menu > New option to create a new scenario.
In the next dialog box you can now create a scenario.
- 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.
- Choose the WebToursScript, which is the script which was created in the VUGEN editor.
- 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.
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.
- We can see that our script is loaded as webtoursscript, which is correct. It has a quantity.
- 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.
- 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.
- 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.
When the load test is run, you will get the below Run window.
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 Status – In this screen you can see the following points
- The number of virtual users running at any point in time
- The elapsed time of the load test
- The number of web page hits per second
- The number of passed and failed transactions
- The number of errors in the test
- The ability to stop the load test at any point in time.
If 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 Transactions
Screenshot of Errors
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.
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.
- You will then be presented with the below dialog box to add the load test scripts to the Controller.
- Give the group a name. The group name will be auto populated with the script name once it is chosen.
- 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.
- 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.
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.
You will then be presented with a dialog box in which you can change the desired values accordingly.
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.
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.
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.
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.
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.
You will now see that the SLA has been defined in the Controller.
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 box
- This time choose the option of Goal-oriented scenario.
- Choose the WebHttpHtml2 or any script you want.
- 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.
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.
- 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.
- 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.
You will then be presented with the Load Generator screen. Click the Add button to add a new Load Generator.
- 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.
- 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.
The VUser limits screen has the maximum number of possible GUI and terminal users that can run on the machine.
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.
To start the load test, click the Start Scenario button.
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.
In our next topic we will learn how to use Analysis in LoadRunner?