← Blog

Testing SAP CPI with mock data service

How Figaf tests SAP CPI iflows with mock data by replacing receiver channels in a test copy, so backends do not need to reply the same way.

June 24, 2019 · 3 min read

If you start making any changes to your SAP CPI system you will end up with problems where you need to be able to test your integration flows, if you make modifications to your scripts. In most cases, it will require that you have access to the same backend system and create the same requests.

Figaf had been supporting testing of SAP CPI for about 1 year. We were able to do it in the following way.

  1. Switch the integration flow into trace mode.
  2. Let the user send some messages
  3. Figaf could then pick up all the trace data and use it as a baseline.

To test an integration flow it did the following.

  1. Switch the integration flow into trace mode.
  2. Figaf would send the input data
  3. Figaf could then pick up all the trace data
  4. Compare the data with the original data.

It did provide an easy way to test your iflows and enabled users to compare the data to see if anything had changed.

Why we needed a new way of testing

The old way is good if you don’t have many backend services you are connecting with and they are able to reply with the same data. If you have SuccessFactors it may be difficult to create or fire the same employee multiple times. Or if your interface is expecting a delta of data, then you will not without making modification be able to fetch the correct data.

And then we want to be able to run the test more often, so we can be sure nothing is impacted. It could be our new approach about adding shared resources to SAP CPI, so if you make a modification in a script it will update all the other iflows.

Or if possible be able to run it on the next release of SAP CPI to see that nothing is affected.

How testing SAP CPI with mock data works

The testing works a little differently if you have any receiver adapters. Figaf will create a copy of the iFlow, and replace all Receiver channels with an HTTP call to the Figaf server. It will send information about the current test case and what part of the process it is in. The API exposed at the Figaf server will then return the HTTP headers that have been changed in the process and also the body.

As a user the only thing you need to change is how to select that the test should be performed with mock data.

If there is a change in the iflow then Figaf would automatically synchronize the testing copy, and deploy it.

You can see the demo of how the service works.

Watch on YouTube IRT SAP CPI with mock data

As you can see it is pretty simple to get to work. Just one tick mark on the Testing Template. The solution works with Cloud Connector if you run Figaf on a local installation; you will just need some settings to specify URL and cloud connector information when configuring the iflows.

What are the limits of mock data

With the mock data there are some limits. Some we can probably find a way to solve with more development and feedback from customers.

  • You will not be able to test your adapter.
  • You will not be able to test binary objects in the headers, it is not possible to recover them.
  • It does not support Enrich scenarios at the moment.

Try it yourself

You can start a free trial of the Figaf DevOps Suite and run it in your own landscape.

This post covers these products

Capabilities covered

  • Service mockingYou cannot run the test because the endpoint is not callable, or you cannot call it twice.
  • Regression testingYou cannot tell what a change broke until someone downstream complains.

More from the blog

All posts →

See this working in your landscape

No credit card required.

Integration cost calculator →

Start your free trial

No credit card required

Try Figaf DevOps Suite free for 30 days. It takes less than an hour to get started, and we send everything you need by email.

Join our newsletter

Get the latest about Figaf, SAP and anything relevant to SAP integration, every week in Figaf Weekly.