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:
List --> Value From Set data generator
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.
Number --> Custom String data generator
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.
Script --> Groovy Data Source
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 --> Any data generator and property expansions
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:
The property table contains the following columns:
Column | Description | ||
---|---|---|---|
Name | The name of the property. | ||
Type | Property type: | ||
Mode | Controls the evaluation of the property value:
|
||
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. |
List configuration
The DataGen list property contains a list of values and picks one item from the list on each iteration.
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
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.
|
Script configuration
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
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 | View ↓
Name | Description |
---|---|
Description |
Text describing the test step. |
Name |
The test step name. |
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 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.
See Also
Data Source Test Step
Test Steps
Data-Driven Testing Tutorials