Skip to content






API Explorer


Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

Gloovy step icon

Gloovy steps

A Gloovy step in Gloop is a hybrid between a Groovy script and a Gloop step (hence the name). Gloovy steps have complete access to the Gloop variables that are available in the service where the Gloop step is inserted. If you have some logic that needs to be executed in your Gloop service which can't be provided with the included Gloop steps, you have two choices:

A sample Gloop service using a Gloovy step

A sample Gloop service using a Gloovy step

The example above shows a simple Gloovy step with a function used to calculate Fibonacci numbers count times. In the screenshot, count is 20. Also from the screenshot, you can see the following:

  • On line 1 of the Gloovy step a new function is declared, which is invoked from line 3 and 6.
  • On line 6, the output of the function is being set to a Gloop variable called fibonacciSeries.

The editor for Gloovy steps is the same as the editor used for set expressions.

Gloovy step editor

Gloovy step editor

TORO recommends reading design guidelines to help you write more maintainable, reusable code in Gloop.

Gloovy scripts in the Gloop service editor

To show or hide Gloovy scripts in the editor, toggle or untoggle the "Show Gloovy Script Lines" option from the toolbar's Filter menu.

Gloovy lines in Martini Desktop

Gloovy lines in Martini Online

Errors in Gloovy steps

If your Gloovy step throws an exception (regardless of whether it was from a syntax error or not), Gloop will produce a standard Gloop stacktrace, but with an extra suffix telling you the line number where the error occurred in your Gloovy step. For example, given the error below, the Gloovy step at line 7 threw the exception:

io.toro.gloop.exception.GloopException: groovy.lang.MissingPropertyException: No such property: error for class: Script1
    at NaughtyGloovy.Gloovy(NaughtyGloovy.gloop:2)[7]

Note the second line in the stacktrace, below, which also has some extra notes on the line underneath:

at NaughtyGloovy.Gloovy(NaughtyGloovy.gloop:2)[7]
                       |     Gloop Service   | Gloovy Line Number

Here is a screenshot showing the Gloovy step:

A Gloovy step with error

A Gloovy step with error

Errors in Gloovy steps

Exceptions are thrown at runtime if your Gloovy step has a syntax error. Like any other exception, they will be caught by any parent block steps with a catch.