Data Driving

To facilitate data-driven testing, you can add external data sources to your virtual services.

When you associate an external data source with a virtual service, you need to create mappings between the data columns in the external file, and the columns/headers in your data rule. You do this by configuring binding in the data model.

Array Binding

You can also bind array data. When the message structure contains an array that needs to be data-driven, you need to work with a properly structured Excel file. The file must contain database-like relationships, using primary and foreign keys, which allow the mapping of one row to many. You can create the file manually, or by exporting learned data that is in the desired format to a new Excel file.

The following example shows the relationship between a search definition and the search result. A record in the Search worksheet is identified via its primary key ‘id’, and referenced from the Search Result worksheet via the foreign key ‘searchId’. This enables the return of two rows for a search with id 3, or zero rows for search of id 4.

Data Format Binding

When binding to an Excel worksheet column where the response can contain different data formats (such as for the REST protocol), different response types (such as for the SOAP protocol), or a message structure which can be considered to contain different types, you can also configure binding for this in your data model.

You can configure mappings between real types or formats and cell values, and provide a default value that is used when no value from the mapping table matches. You can configure a value for each possible type or format.

For task details, see Work With External Data Sources.