GrooveBox

How to test SAP Integration Suite Groovy scripts without deploying an iFlow

Testing a Groovy script in SAP Integration Suite usually means editing it in the iFlow, deploying, sending a message and reading the Message Processing Log. That cycle takes minutes. This guide shows how to run the same script in seconds with GrooveBox, and what to check before it goes to a tenant.

Why test scripts outside the tenant

Step by step

  1. Open the playground at https://grooveboxide.com/ and choose the runtime of your iFlow step: V1 (Groovy 2.4, Java 8) or V2 (Groovy 4, Java 17, Script API v2).
  2. Paste the script. Imports such as com.sap.gateway.ip.core.customdev.util.Message, com.sap.it.api.ITApiFactory and com.sap.it.api.mapping.ValueMappingApi work unchanged. Set the function name if it is not processData.
  3. Recreate the message. Paste the body (or load an .xml, .json or .txt file), choose how the script receives it (String, InputStream or byte[]), and add the headers and exchange properties it reads, with their Java type (String, Integer, Boolean...).
  4. Add the lookups the script performs: value mappings, secure store credentials and partner directory parameters. Use test values, never real credentials.
  5. Run with Ctrl+Enter.
  6. Read the result. The Body tab shows the output (XML and JSON are beautified), Headers and Properties show what was added, changed or removed, MPL shows what the script wrote to the Message Processing Log, Console shows println output and API lists the SAP API calls.
  7. Fix and repeat. Compile and runtime errors point to the failing line in the editor.

Example: a script with a value mapping and an MPL attachment

import com.sap.gateway.ip.core.customdev.util.Message
import com.sap.it.api.ITApiFactory
import com.sap.it.api.mapping.ValueMappingApi

def Message processData(Message message) {
    def body = message.getBody(String)
    def order = new XmlSlurper().parseText(body)

    def vm = ITApiFactory.getApi(ValueMappingApi.class, null)
    def target = vm.getMappedValue('S4', 'Country', order.Customer.Country.text(), 'SF', 'Country')
    if (target == null) {
        throw new IllegalStateException("No value mapping for country ${order.Customer.Country.text()}")
    }
    message.setHeader('SF_Country', target)

    def log = messageLogFactory.getMessageLog(message)
    log?.addAttachmentAsString('Incoming payload', body, 'text/xml')
    return message
}

Run it once with a country that has a mapping and once with one that does not: the second run shows the exception and the line that raised it, exactly what the iFlow would do.

Checklist before deploying

What still needs the tenant

GrooveBox tests the script, not the integration flow: adapters, Camel routing, real stream caching, tenant memory limits and calls to external systems (which are blocked here) must still be verified in SAP Integration Suite.

Last updated: