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.

About this task

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 Rational® Integration Tester supports. For more information about these data source types, refer to Integration 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 Rational® Integration Tester.

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 Rational® Integration Tester 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:

Procedure

  1. In Rational® Integration Tester Recording Studio perspective, select multiple recorded events on the Events View window.
    Note: For information about using the Recording Studio perspective to record events, refer to Integration Tester Reference.
    Note: For information about using the Events View window, including searching recorded events, see Specifying the display options in the Events view.
  2. Click the arrow button () next to the Save Stub from selected events button () on the Events View toolbar and then click Save Parameterized Stub on the shortcut menu.

    Alternatively, right-click the messages and click Save Parameterized Stub on the shortcut menu.

    Note: The first and second screens of the Recorded Events wizard are the Resource Type and Data Storage screens. The screens are displayed only if you click the Save button () or press Ctrl-S. Clicking the Save Stub from selected events button () bypasses the Resource Type and Data Storage screens.
  3. On the Operation Assignment screen, you have the option to modify the operation and the events associated with the stub.

    For information about this screen, see Creating basic stubs.

    Note: If you are creating a stub for multiple operations, Rational® Integration Tester attempts to verity that all selected recorded events are associated with the correct operations.

    Click Next.

  4. On the Transaction Assignment screen, group events into transactions.
    Note: The groups that you choose are important because they determine the number of merged messages and thus the number of remaining screens in the Recorded Events wizard. For example, one recorded event may have a single transaction, which means that there is only one mapping. Alternatively, two recorded events may be grouped into two groups, which means that there are two transactions and thus only one mapping. Equally, two recorded events may be put into a single group, which means that there are two mappings.

    For information about this screen, see Creating basic stubs.

    Click Next.

  5. On the Column Mapping screen, map the fields in the selected recorded events to the data source that you want to use for data-driven stubbing.

    The following table describes how to use the Column Mapping screen.

    To... Do this...
    Specify that a field in a recorded event will be a column in the data source
    1. Select the field.
    2. Click Column. The Map to column dialog is displayed.
    3. Click OK. For the selected field, New is displayed under Status.
    Map a field in a recorded event to an existing column
    1. Select the field.
    2. Click Column. The Map to column dialog box is displayed.
    3. In the list, click the column name to which you want to map the field.
    4. Click OK.
    Specify that a field in a recorded event is not mapped
    1. Select the field.
    2. Click Ignore.
    Search for a specific data item in a recorded event
    1. Click Search.
    2. In the Find field on the lower half of the screen, enter your search query.
    3. Press Enter.
    Increase or decrease the number of example values displayed for each field In the Samples field, enter or select the number of examples you want to display. The default value is 2.
    Expand or collapse a node
    1. Click the node.
    2. Click Expand or Collapse, as applicable.

    Click Next.

  6. In the Header Transformation window, all HTTP headers that were identified in the recorded traffic are displayed. Only those headers that are useful in distinguishing one operation from another are enabled. The remaining headers are disabled to make the message or messages more generic. Change any of these assignments if necessary, and click Next.
  7. On the Summary screen, review the configuration of the stub, assign a name, and save it.

    For information about using the Summary screen, see Creating basic stubs.

    Click Finish.

Results

After you click Finish on the Summary screen:

  • The Rational® Integration Tester 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.
Note: The Output tab may not detect a Send Reply action on the Business Logic tab if the Send Reply action is nested under a Lookup Test Data action.