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.

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.

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.

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.

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.

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.

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

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

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

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.

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.

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

- Insert Action: To insert an existing action under a block
- Insert Block: To insert a new block under predefined blocks (init, run, end)
- Remove: To remove action and block from Run Logic Tree
- Move Up: To move action or block upward in Run Logic Tree
- Move Down: To move action or block downward in Run Logic Tree
You may be interested: