Execute logic in LoadRunner runtime configuration
Run Logic is the first setting in the General category of LoadRunner Runtime Settings. The script’s default sequence of events is triggered by Run Logic. In addition, the output logic provides the possibility to insert a multi-action block. Only the ‘Run Logic’ options can be used to repeat these actions (in ‘Run’) multiple times. Please refer to the image below to understand the options available for creating test execution logic.
Image:01
What options are there in the ‘Execution Logic’ tab?
The settings that can be found in Runtime Settings -> General -> Execution Logic are as follows.
1. Number of iterations:
1. The number of iterations tells the driver or VuGen to repeat all the actions listed in “Perform” the specified number of times. Look at the image below, where the value of “Number of iterations” is 10. So, in VuGen and the controller, each action in “Run” is repeated 10 times.
Note: The group properties allow you to select the number of iterations.
Image:02
Always note that if you specify the number of iterations in the runtime configuration, you must set the ‘Run to completion’ option in the controller scheduler for the test. The test runs for the specified time if the test duration is defined in the scheduler.
Image:03
2. Run the logical tree:
All script actions are represented as a tree structure in the execution logic tree structure. Init, Run, and End are the 3 default blocks. During the test, the Run block can be repeated, but the Init and End blocks are executed only once. As already stated, more iterations will result in more iterations of the Execute block. Below these predefined blocks, you can add more blocks and more actions.
Image:04
A. Init – Since this block is executed first, you can put some initial business activities in there, like entering the domain, login page, etc. Once, the initialization block calls the vuser_init() action of the script. Performance testers often use this block to build global variables and functions, assign URL parameters based on command line arguments, get a Vuser’s ID using the whoami() function, and other things. More subblocks and actions can be added under the Init block. Note that you do not need to log in to the Init block. In some specific situations, Vusers must log in and out during each iteration, which requires the login transaction to be held in the Action (Execute) block. So the location of the login transaction depends on the need.
Image:05
B. Execute: The main business process that you want to test is controlled by the order of this block. Activities in the execution block are repeated during execution, which increases the workload on the server. While some performance testers use multiple actions (see screenshot below) to make them reusable, others record all trade flow steps in separate transactions under a single action. Both methods work fine. You are free to select one according to your preferences.
Image:06
‘Logic Execution’ in ‘Group Properties’ should be set to Sequential if trade flows are connected. Please refer to the image below.
Image:07
‘Logic Execution’ in ‘Group Properties’ should be set to ‘Random’ if trade flows are independent. Please refer to the image below.
Image:08
Also, by using the ‘Random’ execution logic option, you can assign the execution percentage to a particular action. Please refer to the image below.
Image:09
Actions can be divided into blocks, as shown in the image below. Blocks can be executed randomly or sequentially. Furthermore, each individual block has the ability to perform internal operations in both directions.
The sum of the percentages of all the blocks should be 100 if you divide the flow into blocks and choose “Random” as the “Logic Execution”. You can change the proportion of the block using Group Properties.
Image:10
C. End: Since this block is executed at the end of all actions, it is appropriate to place business processes, such as logoff, there. Adblock only calls the vuser_end() action in the script once during testing. Additional sub-blocks and actions can be added under the Finish block.
Image: 11
Note that for the End and Init blocks, the group property the pen is always off.
3. Additional settings
Image: 12
- Insert Action: to add a current action below a block.
- To insert a new block below an existing block (start, run, end), use the insert block command.
- Delete: To stop doing something and block from the logical tree structure
- Move up: to move one block forward in the Execute Logical Tree action
- Move down: to send an action of a block in Execute Logical Tree