← All features

Testing

Service mocking

You cannot run the test because the endpoint is not callable, or you cannot call it twice.

The usual reason a SAP integration is not tested is not that the team does not want to test it. It is that calling the endpoint is not possible, the system is not in the test landscape, the call is not idempotent, or someone would have to approve a purchase order that does not exist. Figaf mocks the services the test needs, automatically, based on what the flow calls, so integration developers and testers can run complete flows anyway.

How it works

Mocking is a setting on the test case. You set one checkmark in the testing template, and Figaf does the rest from a recording of the iFlow.

  • A mocked copy of the iFlow. Figaf creates a copy of the iFlow and replaces every call to a receiver with an HTTP Request-Reply call to Figaf, carrying information about the test case and the step in the process. Figaf serves back the headers and payload recorded for that step, so scripts, routing and mappings run as they would against the real service.
  • All request types. Since patch 2204.2, Figaf mocks every type of call that exists in an iFlow, including send steps, not only Request-Reply.
  • Kept in sync. If the original iFlow changes, Figaf updates and deploys the mocked copy automatically. Since release 2206 you can delete all iFlows that Figaf created for testing in one action.
  • Repeated calls. When a flow calls the same local subprocess several times, a counter makes Figaf return the first recorded message, then the second, and so on (release 2208.1). FigafMulticastIndex and FigafSplitIndex correlate nested multicasts and splits, also in mocked interfaces (release 2303.1).
  • Cloud Connector. Mocking works with Cloud Connector when Figaf runs on a local installation, with settings for the URL and Cloud Connector information.
  • Migration testing. When you migrate SAP PI interfaces, including polling adapters such as REST polling and JDBC, Figaf can mock the endpoints so you can test the migrated flow (release 2410).
  • Limits. Figaf changes only headers and payload, not exchange properties. Data stores and variables are not part of the mocking and must be reset outside Figaf. A Content Enricher normally removes most headers after the call, which the mock cannot do, so add a content modifier that removes them or ignore the properties in the test case. You do not test the adapter itself, and binary objects in headers cannot be recovered.
The mocked copy of an iFlow that Figaf creates, where every call to a receiver is replaced
The mocked iFlow Figaf creates for the test
HTTP receiver in the mocked iFlow that calls the Figaf mock data API instead of the real service

Business value

  • Test what could not be tested. Flows that call SuccessFactors to hire an employee, or other services that do not accept the same call twice, can be regression tested on every change.
  • No effort spent building mocks. Creating mock services by hand is difficult and slow. Figaf creates and maintains them, so test coverage does not depend on a specialist writing stubs.
  • Tests run on your schedule. Regression tests can run when partner or backend systems are down for maintenance, or before connectivity to the target landscape exists during a migration.
  • Protected data. Mocking combined with secured testing means confidential production data stays protected, so a contractor can run the test without seeing payroll or financial payloads.
  • Lower risk at go-live. Complete flows are verified before release, instead of only the parts that happen to be callable.

Good to know

Learn more

Included in

Figaf DevOps Suite

Test complete flows without the downstream systems being live

Figaf mocks the services a test needs automatically, so a flow can be tested end to end even when nothing around it is available.

In practice: Running the nightly regression suite at 02:00, when the partner's system is down for maintenance.

Figaf Migration Tool

Validate migrated flows before the target landscape is connected

Test the migrated interface against mocked endpoints while connectivity is still being provisioned.

See service mocking on 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.