Stub actions
Some actions in HCL OneTest™ API are available to message-based stubs only.
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.
- Edit the stub.
- Click the Properties tab. For more information about this page, see The Properties tab.
- 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.
- 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.
- When you have entered all applicable states, select one of them for the Initial State field.
- Provide a key name to identify a conversation in the Conversation Keys field. The Create Session action requires a conversation key.
- Click Create Session action. and add a
- Double click the action to edit it. A row is displayed for each conversation key that you set up on the Properties page.
- 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.
- Click Ok to save.
Pass-through
- 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
- 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.
- 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.