09 July 2009 - 3.0 |
Data Driven Web Service Testing is one on soapUIs' strengths. In soapUI this can be done by Groovy scripting, but in soapUI Pro this is simplified. The basis for this is the DataSource Step.
![]() |
|
soapUI Pro includes a specialized DataSource TestStep that greatly eases the task of creating data driven tests. DataSource steps can further be nested in a TestCase allowing one DataSource to be input to another, for example if directly contains a number of XML data files, the Directory DataSource could be used to iterate the files, and an XML DataSource could be used to extract data from the files.
The following DataSources are currently supported:
A complementary DataSourceLoop step is required and thus available for specifying when and where to loop for each row of data available from the DataSource.
The DataSource editor is divided into 4 parts;
The list of Properties must contain the properties that will be "exposed" by the DataSource step, they are added or removed using the Add/Remove toolbar buttons. Each DataSource then has its own way of reading data into the properties, as described below.
The DataSource drop down select with DataSource to use, and the "Test" button will prompt to select a configurable number of rows from the currently selected and configured DataSource. Returned rows will be displayed in the Test Log at the bottom. The "Preload" and "Share" options are described in the "DataSource Execution" section below.
The DataSource Options dialog is as follows:
The following settings are available:
Depending on the value of the "Preload" option in the toolbar, the DataSource will initialize its external data either before running the TestCase (preload = true) or when first running the DataSource (preload = false). Depending on which kind of DataSource that has been selected and configured, it may not make much sense to set preload to true, for example when using the XML DataSource together with the response property of a request, setting preload to true will fail since the data is first available when the request has been executed.
Consecutive rows are retrieved and read into the exposed properties either when TestCase execution passes the DataSource step or when a DataSourceLoop Step checks for the next available row.
The "Shared" option in the toolbar control if the DataSource should be shared between threads during a LoadTest, meaning that all running threads will read from the same source of data instead of each creating their own.
Read More in our blog about DataDriven Load Testing.
The JDBC DataSource has the following configuration panel:
There are 5 available options pretty straight-forward, with buttons for using wizard for configuring them, and for testing if properly configured:
The JDBC Connection DataSource has the following configuration panel:
Configuration options are pretty much the same as for JDBC DataSource except that here JDBC Connection set on project level is selected instead of configuring driver/connection string for this particular data source. Here is also possible creating a new JDBC connection for specified project which will be added to the project list.
The Excel DataSource has the following configuration panel:
The 3 available options are pretty straight forward:
The Grid DataSource has the following configuration panel:
Grid DataSources are the easiest way of creating a DataSource allowing very rapid data driven testing. While it is not meant to scale to massive amounts of data, it is very useful for early iterations in Agile Web Service Testing and can be replaced for more the more scalable DataSources later.
The grid displays one column for each defined property, columns are added/removed when properties are added removed. Enter data by either typing into the grid or copy/pasting from for example Excel. The last row in the grid is not part of the data but there for adding new rows. The following actions are available from the toolbar under the grid:
The XML DataSource has the following configuration panel:
XML DataSources are very usable since this means you can use a previous response as a DataSource
The available options are:
During execution, the Row XPath will be selected during startup and each rows property values will be selected relative to the current row node (as shown in the above screenshot)
The File DataSource has the following configuration panel:
Files are expected to be in a simple row format (for example comma-separated), where each row contains the supplied data values separated by a configurable separator. The available options are:
The Directory DataSource has the following configuration panel:
The directory DataSource has 2 options:
A DataSource Step with a Directory DataSource need only to define one property which will contain the entire file as read from disk. This could then be input to a request body or a nested DataSourceStep that uses the XML DataSource to extract data from the read file.
The Groovy DataSource has the following configuration panel:
This step allows any kind of DataSource to be created for a DataSource Step. The Groovy script must set desired properties in the available "result" object (a StringToStringMap), available context variables are: