Page cover

Concepts

There are Tests and there are Process- and Map-Scripts.

A script cannot run alone. It needs a ScriptContext which is normally provided during process execution by the Atom. The ScriptContext contains document-, process- and execution properties, as well as the documents.

There is a ProcessScriptContext and a MapScriptContext, with slightly different content: a Map-Script does not have Documents. Instead, a MapScriptContext takes the input variables and provides the output variables after execution.

Process Script Test and Script Context

On the local test environment the Test acts as the host. The Test creates the context that is passed into the script.

The Test

A test class with on e or more test methods (@Test test01()) represents the host - a starting point where you create the ScriptContext (test execution environment) and where you can check if the script did what it was supposed to do: test assertions.

A single Test class can contain one or mare @Test methods. This makes sense if you want to Unit Test your scripts. I do normally start with one or two tests functions (incl. edge tests), to debug and test what I am developing. Over the time, when my script evolves and gets new functionality, I add new Tests. At the end of the day, you always want to run all tests successfully. The old ones, because you want to ensure the script's behaviours has not changed, and the new ones, to ensure the new functionality works properly.

The Script

The script is what you copy & paste into Boomi, later. Let's check the HelloWorld Map Script.

Last updated