10 April 2007 - 1.7 home user-guide eclipse jbossws intellij netbeans maven 1.X/2.X PDF files forums bugs sourceforge






Vote for soapUI at the WSJ Readers' Choice awards in the

'Best Web Services Utility' and

'Best Web Services Testing Tool'

categories

DataSource Steps

soapUI Pro includes a specialized DataSource TestStep that greatly eases the task of creating datadriven 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-datafiles, 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:

  • JDBC DataSource - reads data from a JDBC datasource
  • XML DataSource - extracts data from an XML property
  • File DataSource - extracts data from a columnar data file
  • Directory DataSource - reads files into properties
  • Groovy DataSource - opens for any kind of DataSource

A complementary DataSourceLoop step is required and thus available for specifying whend 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 toolbar for selecting a DataSource and setting properties and options
  • A list of properties to the left for specifying which properties the DataSource reads and exposes
  • A DataSource specific-configuration panel
  • A Test log displaying rows returned when either testing the datasource or when running its containing TestCase

The list of Properties must contain the properties that will be "exposed" by the DataSource step, they are added/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 dropdown 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 TestLog at the bottom. The "Preload" and "Share" options are described in the "DataSource Exection" section below.

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 retreived 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.

JDBC DataSource

The JDBC DataSource has the following configuration panel:

The 3 available options are pretty straight-forward:

  • 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
  • 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 corrsponding property.

XML DataSource

The XML DataSource has the following configuration panel:

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:

Files are expected to be in a simple row format (for example comma-separated), where each row contains the supplied data values seperated by a configurable separator. The available options are:

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

Directory DataSource

The Directory DataSource has the following configuration panel:

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 nexted DataSourceStep that uses the XML DataSource to extract data from the read file.

Groovy DataSource

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:

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


Next: