Message-based stubs overview
A message-based stub is essentially an HCL OneTest™ API resource that listens for incoming messages on a particular transport. A stub can reply to specific messages or message-types, matched according to incoming filters, by using message case actions.
Benefits of stubs
Message-based stubs enable you to simulate services that you are unable to use or that may otherwise be unavailable.
For example, if you are testing a TIBCO BusinessWorks process but you do not always have access to TIBCO Designer, you can record the process events, create a stub from them, and then run the stub in place of TIBCO Designer.
Stubs can use most HCL OneTest™ API transports and schemas, including CHIPS, COBOL Copybook, Fedwire, FIX, SWIFT, and XML.
For example, a stub may be subscribed to an IBM® WebSphere® MQ message queue waiting for messages to arrive or it could be a web service waiting for a SOAP message to arrive over an HTTP connection.
Levels of richness
A message-based stub can be simple or rich. For example, you might want to simulate a single service that uses a single message case and the default case. Alternatively, you might want to simulate a web service or some other point-to-point operation that includes multiple message-types or operations.
- A simple message-based stub will receive a message and (optionally) validate its contents. Based on the validation results or the fact that the message was received, the stub can return some static response, for example, a simple log action, a reply message, and so on.
- In contrast, a rich message-based stub can receive incoming messages and, based on the specific contents of those messages, execute out a more extensive set of actions. For example, it might look up data in a database or spreadsheet, update one or more records in a database, use failure paths, and so on. Through the use of message cases and other actions, a stub can be configured to generate responses in an intelligent manner.