DataGen Test Step

Important

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

pro.png To use this test step, you need ReadyAPI Test Licenses. If you do not have it, you can request it on our website or start a trial.

Editing DataGen test step

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

JDBC Request test step editor

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.

    Important

    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.

data-gen-editor-number.png

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.

Important

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:

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.

DataGenerator Properties

Name

Description

Name

The test step name.

Description

Text describing the test step.

Custom DataGen Test Step properties

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 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 the appearance of the test step editor.

DataGen test step toolbar

See Also

Publication date: