LoadRunner – Runtime Settings – Run Logic

In LoadRunner, the first setting under the General category of Runtime settings is ‘Run Logic’. Run Logic helps to implement the sequence of action defined in the script. Also, run logic gives an option to insert the block which may contain multiple numbers of actions. These actions (under ‘Run’) can be iterated multiple numbers of times using ‘Run Logic’ settings only. Refer to the below figure to understand what are the options available for developing the run logic of a test.

LoadRunner - Runtime Settings - Run Logic
Figure 01: Run Logic

What are the settings available under the ‘Run Logic’ tab?

Following are the settings available under Runtime Settings -> General -> Run Logic

1. Number of iterations: 

The number of iterations instructs VuGen/controller to repeat all of the Actions (under ‘Run’) the specified number of times. Refer to the below figure, in which the value of ‘Number of iterations’ is 10. Hence all the actions under ‘Run’ will repeat 10 times in VuGen and controller.

Note: You can also specify the number of iterations under Group Properties.

LoadRunner - Runtime Settings - No. of Iterations
Figure 02: Number of Iterations

Remember: If you specify the number of iterations in the runtime settings then you have to set the ‘Run until completion’ option in the controller scheduler for the test. In case you specify the duration of the test in the scheduler then the test will run for a specified period.

LoadRunner - Runtime Settings - Global Scheduler
Figure 03: Global Scheduler

2. Run Logic Tree: 

The run logic tree shows a tree structure of all the actions in the script. There are 3 predefined blocks which are Init, Run and End. The Init and End blocks execute only once during the test while the Run block can be repeated. As mentioned above, an increase in the number of iterations will increase the repetition count of the Run block. You can also add extra blocks and additional actions under these predefined blocks.

LoadRunner - Runtime Settings - Run Logic Tree
Figure 04: Run Logic Tree

a. Init: Since this block runs at the beginning, so some initial business processes like enter domain, login page etc. can be added in it. Init block runs only once and calls vuser_init() action in the script. Many performance testers use this block to define global variables and functions, to assign URL parameters on the basis of command line argument, to get the ID of Vuser using whoami() function etc. Additional sub-blocks and action can be added under the Init block. Remember, it is not mandatory to have Login in Init block. In some specific cases, Vusers has to Login and Logout in each iteration which requires a Login transaction to keep in the Action (Run) block. Hence the place of the Login transaction depends on the requirement.

Figure 05: Run Logic Tree – Init

b. Run: This block controls the sequence of the main business process that you want to test. During the execution, the actions of the Run block are repeated and generate the load on the server. Some performance testers record all the steps of business flow in separate transactions under one Action whereas some of them use separate Actions (refer to the below screenshot) to make them reusable. Both ways are fine. You can choose any of them at your convenience.

Figure 06: Run Logic Tree – Run

If business flows are interdependent then choose ‘Run Logic’ under ‘Group Properties’ as Sequential. Refer to the below screenshot.

Figure 07: Group Properties – Sequential

If business flows are independent then choose ‘Run Logic’ under ‘Group Properties’ as Random. Refer to the below screenshot.

Figure 08: Group Properties – Random

You can also assign the execution percentage to a particular action by selecting the ‘Random’ run logic option. Refer to the below screenshot.

Figure 09

The actions can be subdivided into blocks like the below figure. You can make blocks run either in a sequential or random manner. Also, the individual block has a property to run the internal actions in both ways.

Note: If you divide the flow into blocks and select ‘Random’ as a ‘Run Logic’ then make sure the sum of the percentage of all the blocks should be 100. You can change the percentage of the block using Group Properties.

Figure 10: Multi-block scenario

c. End: Since this block runs at the end of all the actions, so business processes like logout etc. can be placed in it. ‘End’ block runs only once during the test and calls the vuser_end() action in the script. You can also add more sub-blocks and action under the End block.

Figure 11: Run Logic – End

Note: The Group Properties setting is always disabled for Init and End blocks.

3. Other Settings:

Figure 11
  1. Insert Action: To insert an existing action under a block
  2. Insert Block: To insert a new block under predefined blocks (init, run, end)
  3. Remove: To remove action and block from Run Logic Tree
  4. Move Up: To move action or block upward in Run Logic Tree
  5. Move Down: To move action or block downward in Run Logic Tree

You may be interested:

Leave a Comment