Messages

HCL OneTest API can publish and subscribe to messages as part of a test. A message normally consists of two parts: a header and a body. The header usually adheres to a predefined logical construction, while the structure of the body can be more arbitrary.

Depending on the transport in use, the message type can be selected by using the Message Type drop-down menu, above the message body.

The message type and content change according to the format that is selected.

To see how to create messages, read Creating messages and applying them to tests. For more information about building the different message components such as transport and formatter, header, body, and validation options, see Messaging transports, formatters, and dynamic formatters. You can also edit the individual elements of the message by using the field editor. See The Field Editor.

After you create a message, you can use the message editor to navigate through and, in some instances, modify a message. The editor consists of two parts:
  • The message editor toolbar: it controls the view in the message editor body.
  • The message display box: it shows a tree view of the message.

The message editor toolbar

Use this toolbar to do the following tasks:
  • Select and link resources available in your project to messages. After the link is established, you can do the following actions:
    • Open or change the linked message.
    • Remove the link between messages.
    • Re-link to a message that was unlinked earlier.
  • Expand or collapse the currently selected node.
  • Navigate to the previous or next interesting node.
    What makes a message interesting:

    HCL OneTest API determines what is interesting, depending on the context.

    For case action, stub input action, consumer actions (subscribe, receive request, receive reply), and producer actions (publisher, send request, send reply) , the following nodes are considered interesting:
    • Enabled store actions.
    • Enabled filter actions on leaf nodes.
    • Enabled validate or assert actions that contain tagged expressions on leaf nodes.
    • Enabled validate or assert actions that do not have expressions on leaf nodes. For example, DoesExist, IsNull, Length, NotNull (excluding type and name as they exist and are enabled by default).
    • Schema errors.
    • Nodes populated from the Rule Cache.
    • Nodes marked as repeating
    For the message differencing window, the following nodes are considered interesting:
    • Difference, for example, added, removed, modified.
  • Open the tag data store.
    What is the tag data store: It is the repository and access point for all of the data tags that are available to a test. See The Tag Data Store.

The message display box

The message display box shows a hierarchical view of the nodes and fields in a message.

message display box

Right-click the message root to view the context menu. The items on the menu for all objects in the message-tree are essentially the same.

  • Contents provides access to field and XML actions, quickly creating a Tag action, and opening up the Field Editor for the selected part of the message. Use the field editor for enabling the type and value of the field to be edited, and field validation and tag storage. See The Field Editor.
  • Schema invokes the schema wizard for creating schema-based messages.
  • Repeating allows creation of repeating elements within a message from a test data set.
  • Rule Cache provides options for creating rules or managing existing rules.
  • Type allows the field type to be reselected.
  • Root allows selection of the root of the schema if there is more than one root.
  • Properties displays the properties associated with message in a separate dialog.
  • Previewdisplays the message either in Bytes mode or in String mode.
    • In Bytes mode, the message will be shown in Hex (hexadecimal) format by default; you can also select Text and an encoding format, as appropriate.
    • In String mode, the message will be shown in a collapsed form.
    Note: The Preview option was previously present in the Field Properties dialog.
  • Add Child (if applicable) adds a child to the end of the message tree.
  • Move Up and Move Down move the current element up or down, relative to the other elements, if possible.
  • Delete deletes the selected object.
  • Cut, Copy, and Paste work like they do in other applications (that is, cutting, copying, or pasting the selected item to/from the clipboard).
  • Expand All and Collapse All expands or collapses the selected message node.
    Note: When you are expanding all nodes in large messages, HCL OneTest API processes the message for up to 5 seconds. After that time, all nodes that could be expanded will be expanded. If necessary, you can expand again to continue expanding any collapsed nodes.
  • Add Attachment lets users add a file attachment to the selected message node.

Use the Ctrl+F keys to open the Find editor and search for fields in the message body.