Creating parameterized stubs
A parameterized stub, also called a data-driven stub, is one that uses a data source such as a spreadsheet. You can create a data-driven stub from recorded events.
This method creates stubs from recorded events. For information about recording events, see Using the Recording Studio.
The data fields that have been promoted to the events table are used to create the data source. For more information, see Creating tests from recorded events.
The following table outlines the different types of data sources that IBM® DevOps Test Integrations and APIs (Test Integrations and APIs) supports. For more information about these data source types, refer to API Tester Reference.
| Data Source-Type | Produced by Recorded Events Wizard? | Description |
|---|---|---|
| File data source | Yes | This reads data from a file, for example, a comma-separated
value (CSV) file, a fixed width file, or some other delimited file-type. This data can be supplied to any tests or stubs in Test Integrations and APIs. |
| Excel data source | No | This reads data from a worksheet in a Microsoft™ Excel workbook file. |
| Database data source | No | This reads data from a table in a database or the results of
a query on a database. Note: The database must be set
up in Test Integrations and APIs Architecture School perspective before
this data source can be created. |
| Directory data source | No | This reads in a set of files, for example, a set of XML documents. |
You can create a data-driven stub from recorded events or you can create a data source for a driven stub without using recorded events.
For example, you could create a stub by using the associated operations Message Exchange Pattern properties (for information about this, refer to Creating a stub by using MEP) and then modifying the stub to read information from an Excel workbook file (with or without repeating elements), look up specified data, and then send any matching data in reply messages (for information about this, refer to Modifying message-based stubs).
To create a data-driven stub from recorded events, do the following steps:
After you click Finish on the Summary screen:
- The Test Integrations and APIs Test Factory perspective is displayed, and the newly created stub and data source are displayed under the relevant logical resource on the component tree in the Test Factory perspective. If you created a stub for multiple operations, the stub is displayed under each applicable operation.
- If you selected the Open resource after finish check box on the Summary screen, the stub is also opened in the Stub Editor (for information about this, refer to Modifying message-based stubs). A Lookup Test Data action that uses the new data source is displayed on the Business Logic tab on the Events tab of the Stub Editor.

