Debugging message-based stubs
Use the Message Differences window or options available within the stub console display to debug message-based stubs.
Message-based stubs include an Events page that lists model
messages that the stub attempts to match to incoming messages. Each
of these model messages is considered a case, such as
you would find in a switch statement in Java™. A Guard field offers
the option to mark a model message as containing an Expression,
or as No Match, which means that the message
is to be used as a default if no other match is found. These messages
are read in order, and the No Match option
is available for the last message in the list only.
When you run a test against a stub, an entry is displayed on the stub console when a match is found. You can right click the entry for a list of options.
If you click Show Differences, the Message Differences window is displayed. See The Message Differences window for stubs in this topic. For the other options, see Console options in this topic.
If no match is found and you have a default case (a message with a No Match guard), an entry is displayed for the default case on the stub console. You can right click the entry for a list of options, as shown in the following illustration.

If you click Show Message, the Message Differences window is displayed. See The Message Differences window for stubs in this topic. For the other options, see Console options in this topic.
The Message Differences window for stubs
Use the Message Differences window to debug any message-based stubs that generate error messages on the Test Lab perspective Console window. Debug the stub to determine why no events were matched.
- You do not have to move from the Test Lab perspective to the Test Factory perspective and analyze each expected message to determine why it did not match any of the events.
- You have access to the received messages for side-by-side comparison with all expected messages from the events associated with the relevant operation in the currently selected stub.
Console options
The following options are available when you right click a message case or default case message in the stub console.
| Option | Case | Description |
|---|---|---|
| Open Action | Message and Default | Switches to the Test Factory perspective and opens the stub for editing. |
| Overwrite Expected Field | Message | Replaces the value of the specified field in the stub with the value from the incoming message. This option is available when the expected message differs from the incoming message in only a single field. |
| Overwrite Expected Message | Message | Replaces the model message in the stub with the incoming message. |
| Enhance stub to support this request | Default | Adds the incoming message to the Events list in the stub. |