26 September 2007 - 1.7.6 | home user-guide eclipse jbossws intellij netbeans maven 1.X/2.X PDF files forums bugs sourceforge

Home
Getting Started
User Guide

- Overview
  - Tabbed Desktop
  - License Management
  - Preferences
  - XPath Selection
  - Script Library
- Workspaces
- Projects
- Interfaces
  - Interface Viewer
- Operations
- Working with Requests
  - Form Editor
  - Overview View
  - Outline Editor
  - Message Inspectors
  - Attachments/Inline Files
- Functional Testing
  - Getting Started
  - TestSuites
  - TestCases
    - Test Requests
      - Assertions
      - Editor Wizards
    - Property Transfers
    - Conditional Gotos
    - Groovy Scripts
      - Examples
      - GroovyUtils
    - Properties Step
    - Delay Step
    - Mock Response
    - DataSource
    - DataSource Loop
  - Property Expansion
- Load Testing
  - Getting Started
  - Limit & Strategies
  - Execution
  - Assertions
  - Diagrams
  - JMeter comparison
- Mocking
  - Getting Started
  - Mock Services
  - Mock Operations
  - Mock Responses
- Usage Scenarios
  - Data-Driven Testing
  - Template-Driven Testing
  - Interactive Testing
  - Surveillance Testing
- Tool Integrations
  - Code Generation
  - WSDL Generation
  - WS-I Tools
  - Apache Tcp-Mon
- CommandLine Tools
  - TestCaseRunner
  - LoadTestRunner
  - MockServiceRunner
  - ToolRunner
- Keyboard shortcuts

IDE/Tool Plugins
Search soapUI site
Project Documentation

- About soapUI
- Project Info
- Project Reports

## soapUI Pro 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
- Excel DataSource - extracts data from an Excel (xls) file
- Grid DataSource - allows entry/management of data from within the editor
- 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 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

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.

### DataSource Options

The DataSource Options dialog is as follows:

The following settings are available:

- Shared - controls whether this DataSource should be shared between threads in a LoadTest (see below)
- 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
- 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

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

### Excel DataSource

The Excel DataSource has the following configuration panel:

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:

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:

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: DataSourceLoop Step