Assigning random numbers to virtual users

When a recorded value in the test contains variable data, and you want to substitute that value with a random number during the schedule run, you can assign random numbers by using a Random Number built-in datasource.

Before you begin

You must have performed the following tasks:

About this task

The default configuration uses the same seed for the generation of random number to provide predictable results from one schedule run to another. You can introduce variability from one schedule run to another by setting a new seed for each schedule run by using the rptSeed System Property.

You can use the System Property called rptSeed to initialize the random number seed for each virtual user. The default value of rptSeed is 1. You can override the default value by adding the System Property rptSeed to the General Property called RPT_VMARGS in HCL OneTest Performance.

You can provide unique values for rptSeed for each schedule run only when you need variability in the random number generation. Otherwise, you can use the default value.

Procedure

  1. Expand the Location directory from the Test Navigator pane.
  2. Double-click the location from the list.
  3. Click the General Properties tab.
  4. Click Add.
  5. Enter RPT_VMARGS in the Property Name field.
  6. Assign a value to rptSeed that you want to use in your schedule run in the Property Value field.

    For example, RPT_VMARGS=-DrptSeed=123

    The value 123 results in different random numbers for a given virtual user in the schedule as compared to results when using the default value of 1. If you want different random numbers to be generated for your subsequent schedule runs, you must change the value of rptSeed before you start the next schedule run.

  7. Click OK.

Results

You have assigned the desired value to the random number generator seeds.

What to do next

You can run the schedule and verify in the test log that you are getting the random number variability as desired.