Applies to ReadyAPI 2.6, last modified on January 15, 2019

About DataSource test step

The DataSource test step retrieves data from different sources to use it in data-driven tests.

The DataSource test step allows you to read data from different data storages (Excel sheets, databases, text files, and so on), or generate them during the test run, and then provide them to other test steps as properties of the DataSource test step.

One test step uses only one DataSource type and gets a value for one or more different properties. SoapUI supports the following data sources:

Data Source Description
Data Connection Gets data from a database by using a JDBC connection. It is similar to JDBC DataSource, but uses the connection that is shared among the project.
Data Generator Generates test data using a number of built-in data generators.
Directory Iterates through the specified directory and gets file content.
Excel Gets data from an Excel sheet.
File Obtains content of the specified file line by line.
Grid Returns data specified in the DataSource editor’s grid.
Groovy Generates data by using a Groovy script.
JDBC Gets data from a database by using a JDBC connection. Unlike Data Connection, this data type uses the connection specified only for the test step.
JSON Parses the desired data from the JSON content by using JSONPath.
Tip: To learn more about the JSONPath syntax, see JSONPath Reference.
XML Parses the desired data from the XML content by using XPath.

When the test is executing the DataSource step, it reads all the available data and assigns the value of the first data row to step properties.

To iterate through the data rows, you need to add the DataSource Loop test step.

Requirements

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

Editing DataSource test step

After the creation, you can modify test step settings: select the DataSource type and specify the test step’s properties.

DataSource test step editor

Click the image to enlarge it.

Here is a brief description of available panels in the test step editor:

Properties panel

Shows the list of step properties. The DataSource test step reads data from a data source into these properties (the first read values go to the first property on the list, the second value – to the second property, and so on).

To manage the list, use the toolbar items:

  • – Adds a new property to the end of the list.

  • – Removes the selected property.

  • – Loads the list of properties from a file.

  • – Clears the list of properties.

  • – Renames the selected property.

  • and – Move the selected property up and down in the property list.

Also, you can import a list of properties from a file.

Configuration panel

In this panel, you can select the DataSource type and connection parameters.

Data log

In the Data Log panel, you can preview retrieved values.

Property list

Besides the test step editor, you can adjust the test step’s behavior by using its properties in the DataSource Properties and Custom Properties tabs.

Name Description
Name

The test step’s name.

Description

Text describing the test step.

DataSource Type

Shows the selected type of the data source.

Records Per Iteration

Shows how many rows the data source loads for each iteration. You can change the value in the test step’s options.

Complete Last Operation

Shows whether ReadyAPI will perform the iteration even if the number of remaining rows in the data source is less than the number specified in the Rows Per Iteration option.

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 a test step:

DataSource test step toolbar

Click the image to enlarge it.

Here is a description of some commands:

  • – Retrieves data from the specified data source. You can use this item to check if you specified connection settings correctly.

  • – Removes the retrieved data from memory and clears the Data Log.

  • – Opens the Options dialog to configure the test step properties.

DataSource test step options

Data sources have some configurable options for ways to handle data.

To open the Options dialog, click on the test step toolbar.

The options apply to the selected DataSource test step regardless of the data source type.

Options are organized into three tabs:

Settings

The Setting Tab

The tab contains the following options:

Option Description
Restart on Run If this option is enabled, the iterator of the data source is set to the first row every time the test reaches the DataSource test step.
Preload If this option is enabled, the test step tries loading the data from the data source before running the test case.
Fail on Empty If this option is enabled, the test step fails if the data source is empty.

Use this option to create data-driven assertions, if, for example, the SQL query of JDBC DataSource contains a WHERE clause that uses Property Expansion to select data corresponding to a previously returned response.

Skip Loop on Empty When this option is enabled and the data source is empty on initial execution, ReadyAPI continues test execution from the first corresponding DataSourceLoop test step in a test case.
Start Row A zero-based index of the initial row that the data source uses.
End Row A zero-based index of the last row that the data source uses.
Rows Per Iteration Specifies how many rows the data source loads for each iteration. The minimum value is 1.
For information on how to refer to a specific row, see Obtain Property Values of the Specific Row.
Run last iteration When this option is enabled, ReadyAPI will perform the iteration even if the number of remaining rows in the data source is less than the number specified in the Rows Per Iteration option.

For example, if you get two rows in each iteration and the data source has three rows, at the second iteration only one row will remain. When the option is enabled, ReadyAPI performs the iteration. Otherwise, it exits the data source loop and continues the test.

Data processing

Data Processing Settings

The tab contains the following options:

Option Description
Trim Specifies whether the test step will remove leading and trailing spaces from the retrieved text values.
Entitize Specifies whether the test step will replace special HTML symbols (like & or >) with the appropriate entities (like & or >).
Expand If selected, the test step will expand property expansion expressions in retrieved values.

Load testing

Load Test

This tab contains options that control the DataSource test step’s behavior during a load test run:

Option Description
Shared Specifies if the data source is shared between concurrent virtual users.

Enable this option to command virtual users to use the same data source iterator. The test step will move the iterator to the next row every time some virtual user reads data from the data source. So, the next virtual user will use data of the next row.

If the option is disabled, each virtual user has their own iterator and moves through the data source independently from other virtual users.

Restart Shared Works only if the Shared option is enabled. Specifies whether the test step will reset the data source’s iterator when it reaches the last row. If the option is disabled, and the iterator is beyond the last row, then --
  • The DataSource test step returns empty values in its data properties.

  • The DataSource Loop test step that uses this DataSource considers the DataSource to be over. The TestCase execution continues with the test step that is after the DataSource Loop test step.

Logging

While the test step editor is open, you can see retrieved values in the Data Log panel. If the test step is run as part of a test case, you can see brief information on the test step run in the Transaction Log panel.

Working with

Below, you can find information on common tasks that you can perform with the JDBC Request test step.

  1. Click and specify the needed file. You can select .XLS, .XLSX and .CSV files.

  2. On the next dialog, specify parameters of the import:

    • If you select a .XLS or .XLSX file, specify the name of the desired worksheet and the starting cell.

    • If you select a .CSV file, specify a separator and the desired row.

  3. ReadyAPI generates a list of properties specified in the file.

  1. Select the DataSource type from the Data Source drop-down list.

    ReadyAPI will display the data source properties in the Configuration panel.

  2. Configure the properties to specify connection parameters and other settings.

    The parameters differ from one data source type to another. For detailed information, see DataSource Types.

To command a DataSource test step to load several rows in one iteration, do the following:

  1. Open the DataSource Options dialog and select the Settings tab.

  2. Specify the desired amount of rows in the Rows per Iteration box.

If the total number of the data source rows is not a multiple of the specified value, then, during the last iteration, there rows to be filled with data will not be enough. The Run last iteration option controls what ReadyAPI should do in such cases. If the option is enabled, ReadyAPI runs the iteration anyway. Otherwise, it exits the DataSource loop and continues the test.

During the test, the DataSource test step loads the specified number of rows in each iteration. To refer to a specific row, use the following property expansion syntax:

${DataSouceTestStep#DataSourceProperty::RowNumber}

Where:

  • DataSourceTestStep – Specifies the name of the desired DataSource test step.

  • DataSourceProperty – Specifies the desired property of the test step.

  • RowNumber – Specifies a zero-based index of the desired row.

If a data source gets multiple rows, and you do not specify RowNumber, the expression returns the last received row.

Show Example

See Also

JDBC Request Test Step
DataSource Loop Test Step
Data-Driven Testing Tutorials
Prepared Properties
Load Testing
Test Steps

Highlight search results