Implement run logic

Run logic is the order in which actions run during a test. You implement run logic on the Run Logic tab.

Run logic functions

On the Run Logic tab, the Steps box (available from Step in the menu toolbar) contains the following run logic functions:

Run Block

Calls a set of actions, referred to as children, either sequentially or randomly.

For details, see Run Logic Block step.

Run Action

This enables you to insert an action into the logic block. Specify the action in Arguments > Action Name.

For details, see Call Action step.

Back to top

Implement run logic

  1. Create a TruClient script.

    From the TruClient Development window, select File > New.

  2. Create actions.

    From the Actions tab, create actions for each segment of your business process.

  3. Record the business process into the corresponding actions.

    1. Select an action from the Action dropdown list.
    2. Click the Record button and navigate to the desired starting website. All of your actions will be recorded and displayed in the Development window as you perform your business process. You can stop recording by selecting the Stop button. You can continue recording from any point in the script.

      • To record into a different section of the script, right-click a step and select Record > Record after or Record > Record before to record new steps into that location of the script. If you are recording into a group step, select Record > Record into. For more information on group steps, see <Group Actions>.
      • To create new actions while recording, click Manage Actions to the right of the Action dropdown list to display the Manage Actions dialog box containing the Actions List. On the Actions List bar, click to add an action, name the Action and save it. You are returned to recording and your actions on the browser are recorded in the new Action.

      Complete steps a and b for each Action in your business process.

  4. Implement Run Logic in a specific block.

    1. Click the Run Logic tab.
    2. Select one of the three blocks to implement logic: Init, Action, End. For details, see Run Logic tab.

    3. If you want to run a group actions as a set, either randomly or sequentially, add a Run Logic Block step from the Toolbar to the logic block. For details on implementing this step, see Run Block.

    4. To add a single action to logic block, add a Call Action step from the Toolbar. For details on implementing this step, see Call Action step.

Back to top

Run logic examples

Note: If you are working in TruClient in VuGen, you must clear the Simulate a new user on each iteration check box in VuGen Runtime Settings > Browser Emulation node for the examples to work.

Scenario

Let's suppose that your website is a travel site enabling customers to search and book flights.

To test the performance of your travel site, record a user performing the following actions:

Action

Action Name
Log into the application Login
Search for a flight Search_flight
Select a flight Select_flight
Book a flight Book_flight
Log out of the application Logout

Sequential run logic

The following example shows how to structure the script to run all of the actions sequentially.

  • The Init Block section's run action has been set to call the Login action. This block will run once.
  • A Run Block step has been inserted into the main Run Block section.
  • In the Argument section of the Run Block step, three Call Action steps have been inserted, one for each action: Search_flight, Select_flight, and Book_flight.
  • Argument > Iteration has been set to 10.
  • Argument> Mode has been set to Sequential.
  • The End Block section's Run Action has been set to call the Logout action. This block will run once.

Random run logic

You may want to run actions randomly. This example shows how to structure your run logic to run your actions randomly. You can assign a weight to each action to determine how likely it will be run.

  • The Init Block section's run action has been set to call the Login action. This block runs once.
  • A Run Block step has been inserted into the main Run Block section.
  • In the Argument section of the Run Block step, two Run Action steps have been inserted, Search_flight and Select_flight.
  • Argument > Iteration has been set to 10.
  • Argument > Mode has been set to Random.
  • Argument > Child 1 has been set to 75 and Argument > Child 2 has been set to 25. A "Child" is an action in a Run Block. In this scenario, a 75 percent chance has been assigned to Child 1 (Search_flight) to run and 25 percent chance that Child 2 (Select_flight) will run.
  • The End Block section's Run Action has been set to call the Logout action. This block will run once.

Back to top

Run logic limitations

  • TruClient's predefined actions “Init” and "End” are presented in VuGen as “vuser_init” and “vuser_end”
  • You cannot create actions with the names “vuser_init”, “vuser_end” or “Script-View”.
  • If you update settings in VuGen > Runtime Settings > Run Logic it will not be displayed in the TruClient browser until you close and reopen TruClient.

    It is recommended to change the run logic using the run logic tab if the TruClient browser is open and use the Runtime Settings > Run Logic if the TruClient browser is not open.

  • “Script-View” is not a valid action. It is not added in TruClient browser if it has been added to the run logic using VuGen > Runtime Settings > Run Logic.
  • The “Run” section cannot be set to random mode in the TruClient browser. Setting it to random in VuGen > Runtime Settings >Run Logic will be ignored by TruClient browser.
  • Play from selected step will not work for a step that is located in an action that is not part of the run logic.
  • TruClient does not support setting run properties on the master run block such as iteration and run logic.

Back to top

See also: