Skip to content

Testing & SAP Stubs

SAP CPI Groovy scripts often depend on runtime-provided classes. These classes may not be available during local compilation.

What stubs are for

The tools/sap-stubs/ module exists to support local compile/test workflows by providing compile-time substitutes for CPI-provided APIs.

Stubs are intended to help with:

  • local compilation
  • unit test setup
  • development feedback loops
  • avoiding runtime-only validation

What stubs are not for

Stubs should not be treated as production SAP runtime implementations. They exist to make code compile and tests run locally.

Build stubs module

If needed, build or test the stubs module separately:

bash
gradle :tools:sap-stubs:build

Exact task availability can evolve with the repository build configuration.

Testing strategy tips

  • Put business logic in reusable classes where possible.
  • Keep CPI adapter-specific code thin.
  • Test payload builders and transformation logic locally.
  • Use manifests to keep dependencies explicit.
  • Validate CPI runtime-specific behavior in CPI before production use.