DataGen Test Step

Applies to ReadyAPI 3.51, last modified on March 04, 2024
The DataGen test step is deprecated. To generate data, use the Data Generator data source of the DataSource test step.

About DataGen test step

The DataGen test step generates data during a test run.

Switching to Data Source test step

The DataGen test step is deprecated. We recommend that you use one of the following data generators instead:

The Value from Set data generator acts in the same way as List DataGen and has some additional features that help you speed up the setup. For example, you can load the values from a file instead of specifying them manually, and return each row several times to see how your service handles repeated requests.

To get values using a pattern, you may use Custom String Data Generator with the Real macro.

If you need only integer values, use Integer Data Generator. To get floating point values, use Real Data Generator.

Groovy DataSource acts in the same way as Script DataGen, and has additional features that help you improve your scripts. From it, you can access the result variable to modify your generation process depending on previous test results and return multiple values instead of just one as a result of the test step.

Template DataGen does not have a direct alternative. If you need to simulate it in your tests, generate the values with the DataSource test step and add them to the request by using property expansions.

Requirements

To use this test step, you need a ReadyAPI Test license. If you do not have it, you can request it on our web site or start a trial.

Editing DataGen test step

You can modify settings of a test step in its editor:

JDBC Request test step editor

Click the image to enlarge it.

The property table contains the following columns:

Column Description
Name The name of the property.
Type Property type:
  • List - A list of available values which can be read sequentially or in a random order.

  • Number - A number generated based on the configured parameters.

  • Script – A script that generates a property value dynamically.

  • Template – A template to specify a block of content used when building other values.

Mode Controls the evaluation of the property value:
  • READ – The property is recreated each time it is read.

  • STEP – The property is recreated in each test step run.

    The property will contain an empty value until the test step is executed.
Shared Specifies whether the property is shared between threads in load tests. For example, if you are using the Number property to create unique sequential IDs, and also need these IDs to be unique across threads, the property should be shared. Otherwise, each thread would create the same sequence of values.

The DataGen list property contains a list of values and picks one item from the list on each iteration.

Number configuration panel

By default, ReadyAPI uses items in the order they are specified on the list. To use a random item, enable the Randomize option.

Number configuration panel

A DataGen number property generates numbers formatted according to the DecimalFormat class.

Option Description
Start Lower limit of generation range.
End Upper limit of generation range.
Step Interval between generated values.
Pattern Specifies the format of the generated numbers. To learn how to use it, see the reference of the DecimalFormat class and examples on the Customizing Formats web page.
Random Enable this option to generate random values within the specified range. The generated value is divisible by the value specified in the step option.
Persist When this option is enabled, ReadyAPI remembers the last generated value after test run. In the next test runs, it continues the series.
Set Value Defines a value that will be generated in the next iteration.
If the Random option is enabled, this option is disabled.
Script configuration panel

The Groovy script that returns the desired value for the property. For example, the following code snippet generates the current date in the yyyy-MM-dd format:

Groovy

def today = new java.text.SimpleDateFormat("yyyy-MM-dd")
return today.format( new Date())

Tip: You can use property expansions to get the data by using the ${DataGen#today} expression.
Template configuration panel

A template property lets you create complex multi-line values. It is useful when you generate a request body.

Tip: A template can also contain property expansions. So you can use other properties of the test step.

Property list

Besides the test step editor, you can adjust the test step behavior by using its properties in the DataGenerator Properties and Custom DataGen Test Step Properties panels in the Navigator.

Name Description
Name

The test step name.

Description

Text describing the test step.

This page contains properties that you created in the test step editor. You can use the tab’s toolbar items to create and delete properties, save them to and load them from a file. To learn more, see About Properties.

Test step toolbar

The test step toolbar contains commands that allow you to modify the test step or appearance of the test step editor.

DataGen test step toolbar

Click the image to enlarge it.

See Also

Data Source Test Step
Test Steps
Data-Driven Testing Tutorials

Highlight search results