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:
-
Created a test and added a random number datasource to it. See Creating a Random Number datasource.
-
Created a schedule and added a User Group to it. See Adding a user group to VU Schedule.
-
Added a location for the User Group.
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 Test 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
- Expand the Location directory from the Test Navigator pane.
- Double-click the location from the list.
- Click the General Properties tab.
- Click Add.
- Enter RPT_VMARGS in the Property Name field.
-
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.
- Click OK.