> For the complete documentation index, see [llms.txt](https://boomi.markusschmidt.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boomi.markusschmidt.pro/boomi-scriptease/examples/1-debug-an-existing-process-script.md).

# 1 - Debug an existing process script

We are creating a new, empty script file in our project. Then we copy and paste the code of an existing process script into the file. We create a Test to host the script, and we debug the existing script with IntelliJ.

Right click on *training* and select ***New -> Package***, aka: new folder.

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FIfg0dZyPTiFWrOZJZi0A%2Fimage.png?alt=media&amp;token=428d26df-6758-4c31-a48a-b21a79c206a2" alt=""><figcaption><p>create a new package</p></figcaption></figure>

Call the package: `training.example01` . Right click on `example01`\` and add a new, blank Groovy Script. Call it `psgNull` - null: it does nothing, no functionality!

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FYah7hUPOnup7HMtkfRVU%2Fimage.png?alt=media&amp;token=6366c144-d087-4f98-a75f-f32f21f83546" alt=""><figcaption></figcaption></figure>

Goto to **Boomi Integration** and create a new Process Script, call it `psgNull`

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2Flq5lwFXJzel1ROiS2hbx%2Fimage.png?alt=media&amp;token=97365da2-9b30-483e-853b-664cbb123f07" alt=""><figcaption><p>Boomi Integration - Process Script with <em>Null</em> functionality</p></figcaption></figure>

```groovy
import java.util.Properties;
import java.io.InputStream;

for( int i = 0; i < dataContext.getDataCount(); i++ ) {
    InputStream is = dataContext.getStream(i);
    Properties props = dataContext.getProperties(i);

    dataContext.storeStream(is, props);
}
```

Copy the code and paste it into the `psgNull.groovy` file.

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2Fw1xVVlwZcGgcrJLgYosO%2Fimage.png?alt=media&amp;token=aac36b93-b992-47fe-b87d-25e4e5cd2018" alt=""><figcaption><p>psgNull pasted into IntelliJ, with warnings</p></figcaption></figure>

{% hint style="info" %}
IntelliJ gives us some warnings (yellow bars to the right): *Unused Imports* and *Unnecessary Semicolon* - fix it, or leave it. Just to mention here that you eventually want to read and recognize what IntelliJ tells you.
{% endhint %}

Set a breakpoint on line 8, we want to stop there:

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FDjUuWUZ1Fo6nJLgBQslO%2Fimage.png?alt=media&amp;token=ff8e262b-af9a-4a04-b82c-a668d9954031" alt=""><figcaption><p>Null script with breakpoint</p></figcaption></figure>

Now, we want to debug that script, and we **need a Test as a host** to run the process script locally.

### Create Test class from template

Right click on the `example01` folder select ***New -> Boomi Process Script Test*** and provide the Map-Script name (from above: *psgNull*) without *psg*:

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FSgrskW4aAS0ioQN329AN%2Fimage.png?alt=media&amp;token=0c63a481-a787-46dc-98d4-b0d849320cd9" alt=""><figcaption><p>Create a test from a template: the test needs the name of the script.</p></figcaption></figure>

{% hint style="info" %}
**Tip!**

The *MyScripts* IntelliJ project comes with [four pre-configured templates](/boomi-scriptease/knowlede-base/process-script-templates.md), to create new Tests and Scripts. If you have

> ***Project Files** Bar -> Options (three dots)*\
> *-> Appearance -> View Excluded Files*

enabled, you will see the files in the project directory under `.idea\fileTemplates`.\
More information on that topic in the [IntelliJ Help](https://www.jetbrains.com/help/idea/settings-file-and-code-templates.html).
{% endhint %}

Open the created `Test_Null`, click the green arrow and *Debug* method ***test01()**.*

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2F8A42WFtCQtELvlW0zATu%2Fimage.png?alt=media&amp;token=63bec61c-add7-4160-8c0f-dd84427e0eda" alt=""><figcaption></figcaption></figure>

The code execution is going to halt in the debugger in our Boomi Script `psgNull.groovy`on line 8.

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2F9RnFXaK2TSs4GJMeytj9%2Fimage.png?alt=media&amp;token=3f9bfe0c-f600-4e09-8099-9cabffc6bd21" alt=""><figcaption><p>Haltet script</p></figcaption></figure>

Select `dataContext.getDataCount()`, right click and *Evaluate Expression...* to see the data: `value = 1`.

Big question: A value of 1 means, the script has got *one* document! The question is, where did it come from?
