EIPinCPI – Test Message

December 15, 2019 Bhalchandra Wadekar

This week, we’ll study one of the popular system management patterns known as Test Message.

When do I use this pattern?

In software engineering, testing is performed to verify that the build is satisfying the requirements. In Integration, the testing is done by passing a Test Message in the flow. Usually, the test message mimics the original message. The test message should not affect the usual traffic present in the integration system.

Test Message in CPI

In CPI, there are many ways to test a flow or a component like these:

  • Enabling the Trace mode and only connecting the component that is currently being tested.
  • If a flow is exposed using ProcessDirect, then we can send a message from a test flow that connects to the original flow using ProcessDirect.
  • Mapping Simulation
  • Simulation of the Flow or Step(s) in the flow

In this blog, we’ll explore the Simulation option, as I believe, it is the least disruptive to the current flow in the Integration system and therefore is more aligned to the pattern described in the book.

Simulation of the Flow or Step(s) in the flow

Let’s test this flow for XML to JSON Converter from the Mapping Translator pattern blog.

Flow

Flow

Step 1: Set the Start Point

We can set the start point by clicking on the arrow where we want to begin the testing. Let’s click on the arrow immediately before the XML to JSON Converter and press the Play button.

Set Start Point

Step 2: Set the End Point

Similarly, let’s set the end point immediately after XML to JSON Converter by clicking on the arrow and pressing the stop button.

Set End Point

Step 3: Set the Input

To set the input message or Test Message, let’s click on the play button set in step 1 and provide a body.

Set%20the%20Input%20%28a%29

Set the Input (a)

Set the Input (b)

Step 4: Run the simulation

Finally, let’s click the play button at the top right to test this part of the flow.

Run the Simulation

Step 5: The Result

Now, we can see the result at various stages by clicking on the Envelope icon.

Result%20at%20Various%20Stages

Result at Various Stages

I am interested in the final message, so I click on the last envelope to check if the body has been converted to JSON properly.

Result

Result

As expected, the body has been converted to JSON.

EIPinCPI Rating – 9/10

With the great ability to simulate the flow, the Test Message pattern has been implemented very well in CPI. Perhaps, the next step would be the ability to store Test Messages in the CPI and perform the testing through the OData API. That would enable automated testing.

Having said that, the current version of the simulation gives enough for the developer and therefore the implementation of the Test Message pattern is rated 9 out of 10.

Conclusion

Test Message pattern refers to the message used for testing the flow. Such a message should not disrupt the normal flow of the integration system. In CPI, the Test Message pattern is implemented using the simulation feature.

References/Further Readings

Hope this helps,
Bala

About the Author

Bhalchandra Wadekar

Bhalchandra Wadekar is an Integration Enthusiast who authored the Enterprise Integration Patterns in SAP Cloud Platform Integration (#EIPinCPI) series on SAP Blog Community. He is a fan of integration from API Management and Open Connectors to Message Based Integration and Data Integration.

More Content by Bhalchandra Wadekar
Previous Article
EIPinCPI – Message Store
EIPinCPI – Message Store

Next Article
EIPinCPI – Channel Purger
EIPinCPI – Channel Purger