It all started with a basic (yet very important) question:-

Do you test your Groovy scripts?

Or more accurately, How do you test your Groovy scripts?


if(!software.isTestable()) { software = null; }


WebUI, SchmebUI

If we leave it to chance, life with SAP Cloud Platform Integration would be colorless like this:-

How do you even work with such an editor in this day and age… let alone test anything on it??

Well, on occasions like this, pardon me, but I would rather take chance into my own hands, and have a bit more color in my life (code completion and on-the-fly syntax check, anyone?):-


Ok, Eclipse is Groovier, but how do we test?

Well, before Vadim Klimov took matters into his own hands, we would have had to rely on creating our own versions of Cloud Integration’s libraries using techniques like Reflecting on the Message class by Morten Wittrock.

But fortunately for all of us, Vadim bravely trailblazed the way forward with Dark Side of Groovy Scripting: Behind the Scenes of Cloud Integration Runtime.

Before you even continue, you will really need to read thoroughly the above blog, as that is both prerequisite and key.

You will also need the below:-

Eclipse Neon (What do you mean you don’t have it yet?!)

Groovy Eclipse (Eclipse is Groovier with Groovy)


Let the testing begin!

All ready now?

Let’s first create a Groovy Project.


After that, let’s play nice and have a decent package for your Groovy scripts. You will need two scripts here:-

  • The Groovy script that will be used in your integration flow
  • The script that will test the above script

For simplicity, I will just copy over the default Groovy script that is generated from Cloud Integration, namely script1.groovy below.

For the other script, I will just create a new Groovy class named GroovyScriptTest.groovy.


All good so far? Let’s replace the code in the testing class with the following code. It’s just a very basic logic to showcase the approach. Essentially what it does is:-

  • Load the script to be tested
  • Initialize the message to be passed into the script
  • Execute the script to be tested
  • Display the results via console

Nothing fancy, but I encourage you to at least try to understand what each part does (there’s always Google if you need any help!)

package com.equalize.groovy.testing import import // Load Groovy Script GroovyShell shell = new GroovyShell() def script = shell.parse(new File("src/com/equalize/groovy/testing/script1.groovy")) // Initialize message with body, header and property Message msg = new MessageImpl() msg.setBody(new String("Hello Groovy World")) msg.setHeader("oldHeader", "MyGroovyHeader") msg.setProperty("oldProperty", "MyGroovyProperty") // Execute script script.processData(msg) // Display results of script in console println("Body:  " + msg.getBody()) def displayMaps = { String mapName, Map map -> println mapName map.each { key, value -> println( key + " = " + value) } } displayMaps("Headers:", msg.getHeaders()) displayMaps("Properties:", msg.getProperties()) 


You will now notice some syntax errors in both scripts, the most noticeable one would be for the following elusive class:-

Now this is where the fun really begins. Did you bother to read Vadim’s blog? You will need it now. Go hunt for the required JAR file, then add it to the project’s build path.

Once you got all the syntax error sorted, try executing the testing script:-

Right Click > Run As > Groovy Script

Oh no! More errors – looks like some other JAR files are required during runtime. So keep doing the below:-

Hunt, Add, Test, Repeat

Finally, when all is in place, you will be rewarded with the below screen in the console output ????


Voila! Now, this is how you test your Groovy scripts!


Update 20 Oct 2017

Interesting observation – if you head over to (, there is a recently added section detailing how you can add the JAR file for the Message class into your Groovy project ????

Another interesting observation is that it does not tell you where to download the file! :p

New NetWeaver Information at

Very Helpfull

User Rating: Be the first one !