Testing Parts of Flows in CPI with the Simulation Mode

Firstly, thank you SAP developers for increasing and caring for our productivity! It was a pain point and this feature shows that you are listening.


This new feature allows you to test flows without deployment. You can choose the starting point and the ending point for the test. You can define an input exchange with the message body, headers, and properties. Then you can run the flow between two points and check the resulting exchange.

There are new SAP Help pages you should check here.


Here is a sample flow. Content modifier adds a header and Groovy script calculates the sum of two XML fields writing the result back to XML. Note that there are no adapters configured.

The simulation mode doesn’t work while you are editing the flow. First, you should save it and leave the edit mode by clicking “Cancel”

It seems that we will be clicking “Save” then “Cancel” a lot. Maybe the button can be renamed to “Close” to reduce cognitive dissonance?

Click on Simulation Mode. You should see a controller with three buttons. Ignore it for now. Click on the arrow you want to set as the starting point and click on the icon in the middle:

Click on the arrow you want the simulation to stop. Click on the icon in the bottom:

We are ready to prepare the input. Click on the start point:

Prepare the exchange:

Now we can run the simulation! Click the button here:

This feels nice when you don’t have to deploy:

You can see the message content by clicking envelopes at each step!

Here is the example input I have used:

<AddOperation> <FirstNumber>3</FirstNumber> <SecondNumber>4</SecondNumber> <Result></Result> </AddOperation>

And here is the Groovy script:

import com.sap.gateway.ip.core.customdev.util.Message; import java.util.HashMap; import groovy.util.XmlParser; import groovy.xml.XmlUtil; def Message processData(Message message) { def body = message.getBody(java.lang.String) as String def doc = new XmlParser().parseText(body) println doc.FirstNumber[0].text() doc.Result[0].setValue( doc.FirstNumber[0].text().toInteger() + doc.SecondNumber[0].text().toInteger()) message.setBody(XmlUtil.serialize(doc)) return message; } 

Suggestions for more developer happiness

What would happen if we could:

  • store/persist these test run points
  • name or organize them
  • have APIs to run these simulations programmatically

I know these can be hard to implement but I think it can be the killer feature of CPI.