The Behavior tab
With the Behavior tab, you can add reusable behavioral entities, that is, pre-programmed intelligence, to your stub.
A behavior can act as a source of events that cause a stub to run an operation that is not a reaction to an incoming message from an external system. For example, you might want to create a stub that can proactively publish messages that are not just "responses" to an incoming message.
After you define one or more behaviors on the Behavior tab, you can use them as "events" on the Events tab.
- A window that lists any behaviors that are created for the stub, and buttons to create, modify, and delete behavioral entities.
- A text box that displays a description for each selected behavior.
The lower half of the tab comprises a Configuration window that displays details about any behavioral entity with custom instance names.
The following table outlines the default behavior-types that are supplied with HCL OneTest™ API.
Behavior-Type | Description |
---|---|
Lifecycle | Run certain actions when the currently selected stub starts
up or shuts down. For example, you can set up and later clean up any resources that might be required by the stub. |
Timer | Set up a timer that schedules a future callback after a specified
delay so that the stub receives an event to which it can respond. Tip: Callback timer settings for a stub can be
overridden for each event that is created for the stub (for information,
see The Events tab). |
The following table describes the buttons on the upper half of the Behavior tab.
Button | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|
Add | Opens the Add Behavioral Entity dialog. The upper left side of
the Add Behavioral Entity dialog displays the available behavior-types.
The upper right side of the Add Behavioral Entity dialog displays
a description for each selected behavior-type. The
default available behavior-types are as follows:
The lower half of the Add Behavioral Entity dialog displays the available sample behaviors for the currently selected behavior type. The Instance field is used to refer to the behavioral entity in function actions. This field is optional so that you can create multiple instances of a behavior. Based on the selected behavior, a default instance name is displayed. If required, you can specify a different instance name. The following sample
behaviors are listed:
The following table describes each of the Timer function
behaviors that you can use to schedule a single timer event, schedule
a repeating timer event, or cancel a timer event.
An example of calling a Function Action from the logon
event for setting a timer to log out the user from a session after
a specified time period. In
this example:
Tip: To select multiple behaviors for a behavioral
entity, hold the Ctrl key and click each behavior
after you select a behavior-type on the upper left side of the Add
Behavioral Entity dialog. After you specify the properties of a behavior, click Add to create the behavior and to close the Add Behavioral Entity dialog box. Tip: Although behavioral entities
display on the list window on the upper left side of the Behavior tab,
each new behavioral entity also has its events (qualified by the name
of the behavior instance) available as values in the Events field
on the Events tab for the stub. For more information,
see The Events tab. |
||||||||
Edit | Opens the Edit Behavioral Entity dialog, so you can modify instance details for the selected behavioral entity. | ||||||||
Delete | Deletes any behavioral entities that are selected in the list
window on the tab. Tip: To select multiple
behavioral entities for deletion, hold down Ctrl and
click each entity. |