LoadRunner – Runtime Settings – Run Logic

LoadRunner Runtime Settings - Run Logic Logo

In LoadRunner, the first setting under 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 time 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 ‘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 ‘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 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 variable and function, to assign URL parameter on the basis on command line argument, to get the ID of Vuser using whoami() function etc. Additional sub-block 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 Login transaction to keep in the Action (Run) block. Hence the place of Login transaction depends on the requirement.

Figure 05: Run Logic Tree – Init

b. Run: This block controls the sequence of main business process which you want to test. During the execution, the actions of Run block are repeated and generated 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 the ways are fine. You can choose any of them as per your convenience.

Figure 06: Run Logic Tree – Run

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

Figure 07: Group Properties – Sequential

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

Figure 08: Group Properties – Random

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

Figure 09

The actions can be sub-divided into blocks like the below figure. You can make blocks run either in a sequentially or random manner. Also, the individual block has a property to run the internal actions in both the 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 vuser_end() action in the script. You can also add more sub-block and action under End block.

Figure 11: Run Logic – End

Note: Group Properties setting always disable for Init and End block.

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 Reply

Your email address will not be published. Required fields are marked *