10 June 2009 - 3.0-beta-2 user guide eclipse intellij netbeans maven download nightly forum bugs blog sf.net eviware


Eviware Logo

soapUI Pro DataSource Steps

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.

Start soapUI Testing
Did you know?

soapUI Pro has functionality for creating data driven tests -for example from data bases or Excel- easily.

The Data Source Steps soapUI pro will improve your productivity and make Web Service Testing fun.

Try soapUI pro to soap test

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

The DataSource editor is divided into 4 parts;

  • A list of properties to the left for specifying which properties the DataSource reads and exposes
  • A toolbar to the top right for selecting a DataSource and setting properties and options
  • A DataSource specific-configuration panel to the right
  • A Test Log inspector at the bottom for displaying rows returned when either testing the datasource or when running its containing TestCase

soapUI Pro DataSource Editor for data driven soap testing

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.

DataSource Options

The DataSource Options dialog is as follows:

soapUI Pro DataSource Options

The following settings are available:

  • Shared - controls whether this DataSource should be shared between threads in a LoadTest (see below)
  • Restart Shared - controls if a shared DataSource can be restarted during a LoadTest
  • Restart On Run - controls if the DataSource should be restarted every time the TestStep is executed
  • Preload - preloads the data before running the TestCase
  • Fail on Empty - fails the DataSource step if no data is available. This option can be used to do data-driven assertions, if for example the SQL query of a JDBC datasource contains a WHERE clause that uses property expansion to select data corresponding a previously returned response
  • Goto Loop on Empty - if the DataSource is empty on initial execution, this option will transfer TestCase execution to the first matching DataSourceLoop step after the DataSource in the TestCase
  • Start Row - the first row in the configured DataSource to use (first row = 0)
  • Last Row - the last row in the configured DataSource to use
  • Trim - trims values retreived from the DataSource
  • Entitize - entitize values retreived from the DataSource
  • Expand - expand property-expansions in DataSource values

DataSource Execution

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.

JDBC DataSource

The JDBC DataSource has the following configuration panel:

soapUI Pro JDBC DataSource Options

There are 5 available options pretty straight-forward, with buttons for using wizard for configuring them, and for testing if properly configured:

  • Driver - the JDBC Driver to load and use for this DataSource. Must be available in the soapUI classpath either by placing it in a soapui/bin/ext directory, the jre/lib/ext directory or by directly modifying the soapui.bat/.sh files to include the required jar files
  • Connection String - the connection string to use, pass_value will be replaced with real password value at the time of connecting
  • Password - the masked password value
  • SQL Query - the query to issue for the created connection. It must return at least the same number of rows as specified in the Properties List where there must be a column with the same name as its corresponding property.
  • Stored Procedure - select if the SQL statement calls a stored procedure

JDBC DataSource Configuration wizard

    Configuration wizard has several steps for setting driver/connection string, checking if stored procedure and creating query

    JDBC Connection configuration wizard

    DB Connection stored procedure check

    JDBC Connection query wizard

    Notice that when using a wizard in case of stored procedures only procedures with no parameters will be listed because current configuration has no way of setting parameters

JDBC Connection DataSource

The JDBC Connection DataSource has the following configuration panel:

soapUI Pro JDBC Connection DataSource Options

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.

Excel DataSource

The Excel DataSource has the following configuration panel:

soapUI Pro Excel DataSource Options

The 3 available options are pretty straight forward:

  • File - the excel file containing the data to use
  • WorkSheet the worksheet in the file containing the data to use
  • Start at Cell - the top left cell to start at when extracting data.

Grid DataSource

The Grid DataSource has the following configuration panel:

soapUI Pro Grid DataSource Options

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:

  • Delete Rows - prompts to delete the selected rows
  • Insert Rows - prompts to insert a number of rows at the current row
  • Clear Cells - prompts to clear the selected cells

XML DataSource

The XML DataSource has the following configuration panel:

soapUI Pro XML DataSource Options

XML DataSources are very usable since this means you can use a previous response as a DataSource

The available options are:

  • Source Step - the TestStep containing the XML property to read from (could be another DataSource)
  • Source Property - the Property containing the XML to use
  • Row XPath - the XPath expression to use for selecting the "Rows" for the data
  • Column XPaths - one XPath expression for each DataSource property relative to the Row XPath

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)

File DataSource

The File DataSource has the following configuration panel:

soapUI Pro File DataSource Options

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:

  • File - the file to read
  • Separator - the separator for the columns in each row
  • Trim Values - values will be trimmed after reading

Directory DataSource

The Directory DataSource has the following configuration panel:

soapUI Pro Directory DataSource Options

The directory DataSource has 2 options:

  • Directory : the Directory to scan for files
  • Filename Filter : a standard FileName filter used to narrow down which files to read

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.

Groovy DataSource

The Groovy DataSource has the following configuration panel:

soapUI Pro Groovy DataSource Options

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:

  • "result" - for specifying result values
  • "context" - the current TestRunContext for storing context-specific values
  • "testRunner" - the current TestRunner object


Next: soapUI Pro DataSourceLoop Step for data driven testing