To facilitate data-driven testing, you can add external data sources to your virtual services. Service Virtualization now supports Excel file data sources or relational database data source (MS SQL, Oracle, PostgreSQL).
When you associate an external data source with a virtual service, you need to create mappings between the columns in the external data source, and the columns/headers in your data rule. You do this by configuring the binding in the Data model.
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 data source.
In case of an Excel file, it 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 export learned data in the desired format, to a new Excel file.
In case of a database data source, Service Virtualization can detect the existing database relations and suggest them when binding the array rows.
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 a data source 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 data source 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.