Run logic

Run logic sets the order in which actions run during a TruClient test.

For details on defining actions, see Script actions.

About run logic

Run logic defines the order and frequency for running script actions during a test. Not all actions that are defined in the script need to be included, and actions can run more than once. So you can build the run logic for the test run without changing the actual code.

Using the run logic tree structure, you can add multiple actions, group the actions into blocks, and define the logic for how the blocks are run.

The run logic for your script can be defined in the Run logic view in the Development window, or in the runtime settings Run Logic view in VuGen (when the Development window is closed). Updates made in one of these views are automatically reflected in the other location.

For more information on using run logic, see Run logic view.

Back to top

Run logic structure

The following table describes the default sections of the run logic structure. The default sections cannot be deleted.

In each of the sections you can add additional Run block and Run action steps, to build the run logic of your script.

Run logic section Description
Init Block

This is the initialize section, run once. It contains the opening sequence of steps to a business process. For example, a login to a web site.

By default, the Init Block calls the Init action.

Action Block

This section is run when a Vuser is in running state. It controls the flow of the actions containing your recorded business processes.

By default, the Action Block calls the default Action.

End Block

This is the finalize section, run once. It contains the closing sequence of steps for a business process. For example a logout from a web site.

By default, the End Block calls the End action.

Back to top

Implement run logic from the Development window

Use the Run logic view in the Development window to implement run logic for the actions in your script.

Note: The Run Logic view in VuGen Runtime Settings also provides functionality for setting run logic for your script. For details, see Run logic view.

To implement run logic from the Development window:

  1. In the Development window, open the run logic view.
  2. Expand the area in the run logic tree where you want to add a block or an action.

  3. Click Add step. The Steps box Run logic tab is displayed.

  4. Drag one of the functions to the relevant section:

    UI Elements Description

    Run block

     

    This function adds a Run block step.

    Edit the step arguments:

    • Iteration. Set the number of times to run the block (loops).
    • Mode. Run the actions in the block, referred to as children, either sequentially or randomly.

    When the mode is set to Random, the run percentage for the children must add up to 100%.

    You can add a block as a child of another block.

    Run action

    This function adds a Run action step to the script, enabling you to insert one of your recorded actions into the run logic.

    • To insert actions into a block, click the expand button add a transaction . Then, drag and drop Run action steps into the box.

    • For each Run action step, select the action you want to call from the dropdown list in the Action name box.

    • If the block is set to run in Random mode, click the percentage number for each child action and define the run percentage:

Back to top

Run logic notes

  • The predefined actions Init and End are presented in VuGen as vuser_init and vuser_end.
  • Do not create actions with the names vuser_init, vuser_end, or Script-View.
  • TruClient does not support run properties on the whole Action Block (called the run block in VuGen), only for the children within added blocks.

    If you set properties for the whole run section in the VuGen > Runtime Settings >Run Logic view, for example number of iterations, or random run mode, these settings are ignored by TruClient.

  • Play from selected step does not work for a step that is located in an action that is not part of the run logic.

Back to top

See also: