A data generator (DG) returns a generated on-the-fly random value assigned to a variable with the same name, which is used to parameterize requests. Depending on the DG type, the value can be random or systematic. DG can be used for creating streams of emulated business data of different types, which can be included in the HTTP load stream. It allows to more realistically mimic physical users interacting with a web application by entering real-world business data. It helps to avoid creating large test datasets manually.

A data generator type determines what random value will be returned: Integer, Double, Date/Time, GUID, or Text.

The following DG types are supported  

  • Integer - Returns an integer between the Min Value and Max Value. 
    • Set Type to AutoIncrement to generate sequential integers starting from the Min Value. After the Max Value is reached, the next integer is the Min Value. If uniqueness is required, make sure that Max Value will not be reached.
    • Set Type to Random to generate random integers between the Min Value and Max Value. The uniqueness of the random numbers is not guaranteed.   
  • Double - Returns a double-precision point number between the Min Value and Max Value.
  • Datetime - Returns a date-time object between the Min Value and Max Value.
  • GUID - Returns a new GUID.
  • Text - Returns a set of characters with a length between Min Length and Max Length. 
  • Constant - Returns a constant text defined in Constant Text property.


    Use the Constant data generator in conjunction with other source variables to add a constant prefix or suffix to dynamic data.

How to create a Data Generator

  1. Select the data generators node on the Test Workflow Tree.
  2. Click Create a New Data Generator to bring up the generator dialog.
  3. Select the DG type that will return the appropriate datatype.
  4. Set When To Evaluate property to On-iteration, On-request or On-read
    1. On-iteration: If the same data generator will be used in more than one parameter, it will generate the same value for the entire iteration.
    2. On-request: A data generator will generate a new value on every use.
    3. On-read: If the same data generator is used in more than one parameter, it will generate a new value (for every iteration) for every recorded value it replaces. 

Tip: Evaluate on iteration

Set the When To Evaluate property to On-iteration to generate a new value on every iteration (default).  In this case, the random values persist throughout the iteration for every VU. That allows using the same random value more than once.

Example: A web form requires entering an email address created by a data generator, twice for verification purposes. In this case, set When To Evaluate property to On-iteration to avoid failing due to entry mismatch.

Alternatively, set it to On-request to generate a new value on every request.

Tip: Evaluate on read

Set the When To Evaluate property to On-read to generate a new random value to replace every unique recorded value. However, two identical recorded values will be replaced by the same data generator value on a single VU-iteration.

For example, if you parameterize 4 recorded values "aaa", "bbb", "ccc" and "aaa" in your test case , then you can get corresponding data generator values "123", "456", "789", "123" on-iteration 1 and 987", "654", "321", "987" on-iteration 2. Note that the 1st and the 4th random values are the same (within one VU-iteration) because the 1st and the 4th recorded values are the same.

An alternative way to create the same type of parameterization is to creating 3 data generators with When To Evaluate property set to On-iteration: DG_aaa to parameterize 1st and 4th the recorded value, DG_bbb to parameterize 2nd recorded value, and DG_ccc to parameterize 3rd recorded value.

However, using n-iteration substantially simplifies parameterization since you can use a single data generator. It's especially helpful when you need to parameterize multiple recorded values.


When a data generator with When To Evaluate property set to On-iteration or On-read is inside a loop object like Loop or Do...While with Increment the index for iteration-bound datasets set to yes, then a new value is generated on every loop iteration.

5. Configure remaining properties and give it a unique name. It will appear in the Variable Picker when you create parameters. Use the Format String property to format the generator output.

6. Click Verify to test the return value.

7. Click Save & Close.

When the DG is used to parameterize a request, it is referred to by its name surrounded by the brackets, for example:  {{MyRndInteger}}.

When the Variable Picker is used to create a parameter, a properly formatted DG name reference is inserted automatically. 

Concatenation Expression Parameters 

Data generators can be used to create parameters base on expressions consisting of two constant substrings with a random value between them. In Concatenate Expression property, enter "{0}" surrounded by prefix and suffix substrings. 

For example, if a data generator Is configured to generate a random integer between 0-100, and its Concatenate Expression property Is set to id ="{0}", then such data generator will render values like id="72" or id ="31".

  • No labels