Creating test resources from recorded or imported events

After events are recorded in a monitored operation or if recorded events are imported, you can create a test, stub, trigger, requirement, operation, or test data sources from the selected events in the Events View pane.

Before you begin

You must have completed the following tasks:

About this task

While creating tests, you can create a test or a parametrized Test. While creating stubs, you can create a stub, parameterized stub, or data model stub. You can also add an event to an existing test or stub.

When you import recorded events in Recording Studio, you can either use the existing monitors or import the monitors. If existing monitors are used, then the operations that exist can be used to create tests. If no operations exist for the imported monitors, you must create operations and associate physical resources in your project before you can create tests or stubs.

Procedure

  1. Verify if monitors are associated with a logical operation. If not, create an operation and associate the monitors with the operation.
  2. Select one or more recorded events in the Events View. You can use Ctrl or Shift to select multiple events, or click one event and drag over the other.
  3. Use the test resource icons on the toolbar to do specific tasks as described in the following table. The tasks that you do depend on whether the selected events are message-based events, or JDBC or SQL events, or a combination of both.
    • For message-based events, all of the test resource icons are available.
    • For JDBC or SQL events, you can only save an event and create a performance profile from selected events.
    • For a combination of events, all test resource icons are available. However, non-message-based events are filtered and not available for further actions, such as when you save the events as a stub. Also, when you save the events to a test, the test will comprise both message-based events and non-message-based events.
    Icon on the Events View toolbar Purpose
    Create test icon To create a test
    Create stub icon To create a stub
    Create trigger icon To create a trigger
    Create message icon To create a requirement
    Create operation icon To create an operation
    Save Events icon To create a test data source, click this icon and then select an option in the Resource Type dialog. The availability of the resource type options depends on the type of messages selected:
    • If all of the selected events are message-based, all of the resource type options are enabled.
    • If JDBC or SQL events are present in the selection, you can choose from among only the following resource types: unit tests, integration tests, performance profiles, and test data sets.
  4. Click Next.

    The Data Storage dialog is displayed.

  5. Specify whether the data should be stored as hard-coded values or in a simple data set.
  6. Click Next.

    The Operations Assignment dialog is displayed.

    When you create a resource from a reply message in HCL OneTest API and the selected event does not have the corresponding request or reply message, a message is displayed.Create Operation warning message
    The following scenarios apply that depend on the type of the recorded events:
    • Incomplete, but all legal transactions. For example, only request messages. In this case, you can add the completing messages by clicking Add Matching.
    • Incomplete transactions, but no complete ones. In this case, you can add the completing messages by clicking Add Matching.
    • A combination of incomplete and complete transactions. In this case, you can either add the completing messages by clicking Add Matching or remove the incomplete ones by clicking Remove Unmatched.
    • Incomplete transactions only and the application cannot find any matching ones that can be added. In this case, you can only cancel the operation by clicking Cancel.
  7. Click Next, and then on the Header Transformation page, change any assignments, if necessary.
  8. Select the operation where the resources are to be saved and provide a name or prefix for the new resources.
    When creating tests or stubs, you must provide a name because only one test or stub is created from one or more recorded events. When creating triggers, test data sources, or requirements, you must provide a naming prefix, because a trigger, test data source, or requirement is created for each selected event. To open the new resource for editing after it is created, select the Open resource after finish check box.
  9. Click Finish.

Results

The new resource is created under the selected operation and opened for editing.