Customizing runtime settings

This topic describes customizing the rts.yml file, to define enhancements for your test runs with DevWeb scripts.

Customizing runtime settings

The rts.yml contains the runtime settings for DevWeb script test runs. The default rts.yml file can be found in the DevWeb root folder, and includes descriptions of the runtime settings alongside each setting.

The runtime settings are specific to each Vuser. If you want to customize these settings, you can do so in a local runtime settings file that you create in the script's folder. When the script runs, the customized runtime settings take precedence over the default runtime settings.

For example, some of the runtime settings that you may want to customize include:

  • Enable log mode and set log level.
  • Proxy settings - including PAC support, proxy server details and authentication credentials, authentication type (basic or NTLM), and excluded hosts.
  • SSL settings, for example, disabling HTTP/2, or ignoring bad certificates.
  • Save snapshots on replay or error.
  • Define run logic for actions. For details, see Implement run logic, below.
  • Think time. For details, see Configure think time, below.
  • Add additional attributes. For details, see Add additional attributes , below.
  • Data push to the Dynatrace AppMon monitor. For details, see Dynatrace AppMon integration.

Note: The supported runtime settings vary, depending on the LoadRunner Developer version you are using.

To customize runtime settings:

  1. Copy rts.template.yml from the DevWeb root folder to your script's folder, and rename it rts.yml.
  2. Customize the copied file and save your changes.

Back to top

Implement run logic

2020 SP1 update: Run logic is supported for version 2020 SP1 and later.

Run logic is the order in which actions run during a test. You can define run logic for DevWeb scripts by adding a flow section to the local runtime settings file (rts.yml) for the script.

For information on customizing the rts.yml file per script, see Script resources.

The flow section defines the order in which the specified initialize, run, and finalize sections are run in the script. You can define random order, random selection, and group actions into blocks.

  • The items in the initialize section are run only once, at the beginning.
  • The items in the run section are actions that can be grouped into blocks, and can run for multiple iterations.
  • The items in the finalize section are run only once, at the end.

By creating your flow, and breaking the actions into blocks, you can build the logic of how your test will run. Not all items that are defined in the script need to be included in the flow, so you can change the run logic without changing the actual code.

Creating blocks

When creating blocks of actions, you can define the logic for how the blocks are run:

Logic name Behavior
Sequential The blocks, or actions in the block, run sequentially (in the order they appear).
Random An action (or block) is randomly picked each time, and only that action or block is executed.
Shuffle Run all actions in the block (or all blocks), but in random order.

Other run logic parameters:

  • loop: This defines the number of times to run the block. It must be a positive number, greater than 0. (You cannot define a loop value on the run section level.)

  • probability: When using random logic, you can define the probability value for each item. This can be any value from 0 to 100, but the total probability for all items must add up to 100%.

Flow section example

The following shows an example of code from a script, and the flow section created for the script in the rts.yml file.

Note that not all items listed in the script appear in the flow; items that are not included will not participate in the flow.

Tip: You can also check out the flow example in the <DevWeb root>\examples\CustomRunLogic\rts.yml file.

Script example:

load.initialize('Set default headers', async function () {
    //Set default headers
});
load.initialize('Login', async function () {
    //Do login
});
load.initialize('Set additional defaults', async function () {
    //Set additional defaults
});
load.initialize(async function () {
    //Initialize something else
});
load.action("Add food to the cart", async function () {
    //Add food to the cart
});
load.action("Add chocolate to the cart", async function () {
    //Add chocolate to the cart
});
load.action("Add marshmallow to the cart", async function () {
    //Add marshmallow to the cart
});
load.action("Add doughnut to the cart", async function () {
    //Add doughnut to the cart
});
load.action("Purchase items in the cart", async function () {
    //Purchase items in the cart
});
load.finalize('Logout', async function () {
    //Do logout
});
load.finalize('Clear cookies', async function () {
    //Clear cookies
});
load.finalize(async function () {
    //Finalize something else
});
load.finalize('Clear headers', async function () {
    //Clear headers
});

Flow section example:

flow:
  # Allow the user to enable or disable the flow control
  enabled: true
  initialize:                                         
    #List of initializers to be used. 
    #An empty list will lead to no initializers.
    items:                                            #List of items to run.
      - name: "Set default headers"
      - name: "Login"
  run:
    #Define the logic between the items, can be sequential, random or shuffle.
    logic: "sequential"                               
    items:                                            #List of items to run.
      - name: "Add food to the cart"                      #Define the action name.
      - name: "Add something sweet to the cart"           #This part create a "block" of actions.
        logic: "random"                               
        #Loop a positive number define the number of times to run the current section
        loop: 3           
        items:
        - name: "Add chocolate to the cart"
          #Probability value between 0 to 100 include. Total probability of all items should be 100%.
          probability: 40                             
        - name: "Add marshmallow to the cart"
          #Probability value between 0 to 100 include. Total probability of all items should be 100%.
          probability: 60
      - name: "Purchase items in the cart"
  finalize:                                           
    #List of finalizers to be used. 
    #An empty list will lead to no initializers. 
    items:                                            #List of items to run.
      - name: "Logout"
      - name: "Clear cookies"

Additional files

In the local rts.yml for the script, you can define additional files in a files section (using the absolute path, if they are not in the script folder). The additional files are automatically loaded as part of the script and therefore contain the load namespace (as defined by the JavaScript SDK). The files section also defines the role of the file - this should be set as script.

In the following example, the additional file is called extra.js:

files:                   # A list of all the extra files which are a mandatory part of the script
  - name: extra.js       # The file name, it can be relative to the script directory or rooted
    role: script         # The role of the file in the script. Currently only "script" role is supported

The <DevWeb root folder>\examples\CustomRunLogic script includes an example for using an additional file with a run logic flow.

Using DevWeb run logic in LoadRunner Professional

When you run your DevWeb script in LoadRunner Professional, the defined run logic flow for your script is displayed in the Run Logic view in the script runtime settings.

Back to top

Configure think time

2020 SP2 update: Think time settings are supported for version 2020 SP2 and later.

Think time defines for how long the Vuser will pause its execution at the point where think time is used. This is to emulate a user pausing before moving on to the next step in a business process.

You can configure think time settings, to control how the Vuser uses think time, and how the recorded think time in your script is handled, during script execution.

In the thinkTime section of the rts.yml file, define the type for think time. The supported types are:

  • ignore. Ignores the recorded think time, and runs the script without any delays.
  • asRecorded. The think time that was detected during recording is replayed without change.
  • multiply. The recorded think time is multiplied by a value you define (from 0.01-10000). For example:

    thinkTime:
      limit: 0
      type: multiply
      arguments:
        by: 5       
  • randomPercentage. Uses a random percentage of the recorded think time, within defined minimum and maximum percentage values. The minimum range you can define is 1-150. The maximum range is 50-10000.

    For example:

    thinkTime:
      limit: 0
      type: randomPercentage          
      arguments:
        max: 50
        min: 3

You can also set a limit value, to define a maximum think time for each think time period during script execution.

  • The possible range is 0-10000 seconds.
  • -1 indicates disabled.

Back to top

Add additional attributes

2020 SP2 update: Additional attributes are supported for version 2020 SP2 and later.

You can provide additional attributes for your DevWeb scripts by specifying user arguments. These are command line arguments that can be retrieved during the test run using load.config.user.args (see Config).

Any user arguments you add to rts.yml can be viewed in the Additional Attributes view in the LoadRunner runtime settings for the script.

Add the additional attributes to the script's rts.yml file using the userArguments parameter, together with each attribute name and its value. For example:

userArguments:
  My_attribute_1: 99
  My_attribute_2: system

Back to top

See also: