## Overview

RunLogic allows users to create a custom flow to be executed by LoadTest. It allows for comparing the expected rate vs the actual rate per second for each block, flow, and page. Flows of the scripts can be ordered here.

In the Assertions tab, you can apply assertions on the created transactions to verify the expected result with the actual result. You can also ensure that the requested page has loaded correctly.

- With RunLogic -
  - All pages/flows can execute as per the requirement.
  - Good control over the execution of pages or the group of pages (Blocks).

## Components of RunLogic

1. Blocks: Any node of a tree having at least one child. A block can contain flow or another block within itself.
2. Flows: For a particular leaf node, all flows are taken from the script itself. A flow once used can't be defined again for the same block.

The runlogic screen is divided into a left pane and a right pane.

## Left Pane

The left pane consists of a tree that includes block and flow. Whatever option is selected the corresponding field is shown in the Right pane. The block is any node of a tree having at least one child. A block can contain flow(s) or another block within itself. Users have the following option in the block:

1. Block
   - Insert Block: If the user selects the Insert block option, he has to fill in the corresponding fields of block name and block type and select the update block button.
   - Insert Flow: If the user selects Insert Flow, the corresponding right pane gives the option to select the flow which needs to be inserted.
   - Move up/down: The user can select option to move up or down the order.
   - Remove: The user can click on icon to remove the block from runlogic
   - Update Block : Update Block Earlier users could not update the block type. He has to delete the block and add the new desired block. Now user can update the block type of the desired block.
2. Flow
   - View: Click on the icon to view the script.
   - Move up/down: The user can select i class="las-arrow-up-solid btn-icon"> option to move up or down the order.
   - Remove: The user can click on icon to remove the block from runlogic

Once you click the block option, you have the following fields:

- Block Name: Enter the name of the block like start/stop.
- Block type: There are the following types of blocks:
  - Sequence block: It is a sequence of flow or blocks. The flow or blocks defined under the sequence Block is executed sequentially as they are given (defined) in the RunLogic.
  - DoWhile Block: A block or page may be executed as a do-while loop Condition for while is provided by a user-specified function. The loop continues until the user-specified function returns true. It has the following fields:
    - Iteration using Loadtest parameter: Select the parameter name from the dropdown.
    - Operator: Select the logical operator from the drop down available like <,>, etc.
    - Type: Select the type like integer, string, or double.
    - Value: Enter the value as per requirement.
    - Expected Iteration: Used only for runlogic progress. We can see the expected running time of the iteration.
  - While Block: It is similar to DoWhile Block. However, unlike DoWhile Block, the loop may not be executed even a single time, depending upon the return value of the function.
    - Iteration using Loadtest parameter: Select the parameter name from the dropdown.
    - Operator: Select the logical operator from the drop-down available like <,>, etc.
    - Type: Select the type like integer, string, or double.
    - Value: Enter the value as per requirement.
    - Expected Iteration: Used only for runlogic progress. We can see the expected running time of the iteration.
  - Count Block: A block or flow may be executed with a specified number of counts. A min and max count is specified.
  - Percentage Block: It is a mixed group of blocks or pages in a certain % mix all adding to 100%. NetStorm selects any of these blocks or flows at the execution time depending on the percentage given. Normally the flow defined with more percentage is given an advantage.
  - Weight Block: It is similar to Percentage Block, but the weights do not add to a pre-determined number.
  - Switch Block: A user-specified function returns the flow or block to be executed. In this we have to select the parameter.
  - Abandon Block: This block does not have any flow. It is only inserted inside the Condition Block. When this block is encountered, the session is exited.
  - Condition Block:This block contains flow having conditional statements. For example, if, then, else.

## Toolbar

The toolbar consists of the following option:

- Create Runlogic : Users can now create an empty runlogic using this button. On clicking this button, a popup appears where the user can enter the name of the runlogic. This new runlogic contains ROOT NODE and START NODE. On clicking OK, a new tab with root and start node(Runlogic) is created where the user can add the flow that they want to execute, and a new runlogic node is added in the script tree under the runlogic directory.
- Save : This saves the RunLogic. This validates if all properties of blocks are satisfied before saving it.
- Collapse All : To collapse the blocks and pages. This collapses all blocks and pages inside the blocks.
- Calculator : It is used to calculate the runlogic. This opens a new window where PVS can be auto-calculated based on the scenario type and the parameters.
- Rename RunLogic: To rename a RunLogic, click on icon.
- Copy Runlogic: To copy RunLogic click icon.
- Reset Tree: This resets the currently modified RunLogic to the previously saved RunLogic, click icon.
- Reset Runlogic : Users can reset the RunLogic tree in any state. After resetting the RunLogic tree, it will return to the last saved RunLogic tree with flow list(s) only and will remove all other blocks from the tree.
- Download Runlogic: This downloads the RunLogic tree. Users can save this file, click icon.
- Delete RunLogic: To delete RunLogic click icon.