Stub actions

Some actions in Test Integrations and APIs are available to message-based stubs only.

The following actions are available for stubs:

Create Session

You must provide a key to establish a session where the underlying transport does not provide the context. For example, in HTTP no state or context is implied between one HTTP request/reply and another. If the server is expected to create the key, then the stub must perform that same role. You provide a regular expression that describes how each key is formed. The keys together identify a session. You can find the values of the generated keys in the SESSION/KEY/keyName tags.

  1. Edit the stub.
  2. Click the Properties tab. For more information about this page, see The Properties tab.
  3. In the Session section, click the New icon to add a state to the States list. The session transitions between these states as it runs.
  4. Provide a value for the Name field, such as Waiting, and, optionally, a short explanation for the Description field, and click OK. You can edit or delete any lines in the States list.
  5. When you have entered all applicable states, select one of them for the Initial State field.
  6. Provide a key name to identify a conversation in the Conversation Keys field. The Create Session action requires a conversation key.
  7. Click Events > Activity and add a Create Session action.
  8. Double click the action to edit it. A row is displayed for each conversation key that you set up on the Properties page.
  9. Double click in the Value Pattern column and enter a regular expression that defines the form of the key that is to be generated. For documentation purposes, you can optionally enter an example in the Example Value column.
  10. Click Ok to save.

Pass-through

If a stub receives a message that it cannot reply to, it does one of the following things:
  • The message is sent on to the real system. You can optionally specify a delay in milliseconds.
    Note: The subsequent actions in the stub are run which might include a Send Reply. Some transports which can only have one reply such as HTTP produce incorrect results in this case. Ensure that you add logic to prevent Send Reply from being run.
  • Discards the message
  • Simulates an error
Default pass-through behavior is determined on the Properties page for the stub. You can override this default behavior by adding a pass-through action. Edit the action and specify the Pass-through action to be taken:
Discard
No reply message is sent to the calling system. No additional fields are available for this option.
Pass-through
The message is sent on to the real system. You can optionally specify a delay, in milliseconds.
Simulate Error
A simulated error message is returned. Provide the content for the error message.

Data Model

A Data Model provides the same functionality as a relational database. Data Models use their own unique terminology. An entity is equivalent to a table in a database. An attribute is equivalent to a column in a table. An instance of an entity is equivalent to a row in a table.

After you create a Data Model by using the Recording Studio wizard, you can use Data Model actions to perform operations on the data. The following operations are available:
Create
Creates an instance of an entity, using the current values of the tag data store.
Update or Create
If an instance of the entity does not exist, the action creates an instance in the Data Model, using the current values of the tag data store. If a unique instance of the entity does exist, it is updated with the current values of the tag data store.
Delete
Deletes an instance of an entity from the Data Model.

If you do not specify an entity in the Path field of the action, the action attempts to determine a default entity, based on context and the current values of the tag data store.