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.
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 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 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.
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.
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.
Hope this helps,
About the Author
More Content by Bhalchandra Wadekar