> 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/general/use-test-data.md).

# Use Test Data

Good practices for the use of test data

The first question that might come up is: "**Where can I get test data?"** that is needed to debug and test my script? The answer is simple as that: run your process, and grab the documents that hit the - not yet developed - Data-Process Shape which is going to host the script.

## Get test data

Imaging, you have a process that executes a Business-Rule and you want to serializes the Business-Rule XML results into a plain string. You want to develop a script for that *XML conversion purpose*, and you need test data.

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FqkMjew3E0h8WNScoQ1xx%2Fimage.png?alt=media&amp;token=baa2657a-3dcc-489a-a50e-8e6fd3088cdc" alt=""><figcaption><p>Copy &#x26; Paste documents from a test execution.</p></figcaption></figure>

* Temporarily add a Stop-Shape where you want to insert the script.
* Run your process.
* Copy and paste as many documents as you need from the Stop-Shape,

  * and save each document as a file\
    in your script's `testData`folder, in you project directory.

  <figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2Fwo4N4Opcf47yT1C6Jyzn%2Fimage.png?alt=media&amp;token=431e42ef-4d27-4ac7-950d-96bdccd9ffd9" alt="" width="201"><figcaption><p>Four files containing test data<br>pasted from a Boomi execution.</p></figcaption></figure>

## Use test data when testing

In your Test class read the documents from file:

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FsTshER44xD7WQ3mPhS9B%2Fimage.png?alt=media&amp;token=90839d1f-1bbc-452b-84a1-47cdd7b32c3c" alt=""><figcaption><p>Reading test data from file.</p></figcaption></figure>

Note: The `_testfiles` object has been created on the class level, and it point to *testFiles* directory, relative to the Test file location.

```groovy
final TestFilesHelper _testFiles = 
    new TestFilesHelper( "testData", _sourceUri)
```

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2F2mYteGe10oFXOWRyX6EU%2Fimage.png?alt=media&amp;token=9248c60d-7cfc-4342-8852-38c499b2a3e1" alt=""><figcaption><p>Test data full-path.</p></figcaption></figure>

## Share local test data with Boomi Integration

If you test on a local machine, using your local ATOM, you can use the *testData* directly from your ATOM. Copy the *testData's* full-path, which is probably: `%UserProfile%\Documents\GroovyTraining.`

1. Setup a generic (empty) **Disk v2** connector:\\

   <figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2F3zH2eTkHkjQpYraNHInp%2Fimage.png?alt=media&amp;token=e5857b9c-3181-4353-b9fa-231e5d55b456" alt=""><figcaption></figcaption></figure>
2. Create a generic query Disk v2 operation:\\

   <figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2F7ibsD65zLHHqVzvE6i9K%2Fimage.png?alt=media&amp;token=abc8f8d2-2e81-4b6c-8683-3020be83ef6a" alt=""><figcaption><p>Generic Disk v2 operation</p></figcaption></figure>
3. Amend your Test-Process to read test data from disk:

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FNz1HDiq0FivcombMsRlt%2Fimage.png?alt=media&amp;token=ac4844b7-3b02-4886-8b01-cec5eb6874da" alt=""><figcaption></figcaption></figure>

The SetProperties Shape sets the **testData directory** and it defines\
`DDP_FileFilter = *.json`

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FqddTj9LKjynNJgkPINCf%2Fimage.png?alt=media&amp;token=a6e4e43a-90fe-4164-8340-fea41727648d" alt=""><figcaption><p>Directory: Fix project path + relative testData directory for this process.</p></figcaption></figure>

The dynamic document property is then used in the Disk v2 operation:\
**matchWildcard parameter**.

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2FuVgZK3WeOaFNvwI0Ydp5%2Fimage.png?alt=media&amp;token=cfe21cf9-801c-4eb2-9ce8-61a8bda2f798" alt=""><figcaption><p>Use DDP_FileFilter in the operation's parameters.</p></figcaption></figure>

{% hint style="info" %}
**IMPORTANT**:exclamation:: It is important that you execute the process on your **local ATOM**, please. A cloud or a customer ATOM normally does not have access to your local disk drive and folder!
{% endhint %}

That is it! Your Boomi test process and your local test script share the same test data.

<figure><img src="https://2919579608-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPdcc5uQt1eQainblDyLx%2Fuploads%2Fr8ACnUBoa3lhmWaix4g0%2Fimage.png?alt=media&amp;token=6c02ab0d-0e6f-4297-9755-3a195447ed71" alt=""><figcaption><p>Process execution with the same four files from local disk.</p></figcaption></figure>
