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.

Copy & Paste documents from a test execution.
  • 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 testDatafolder, in you project directory.

    Four files containing test data pasted from a Boomi execution.

Use test data when testing

In your Test class read the documents from file:

Reading test data from file.

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

final TestFilesHelper _testFiles = 
    new TestFilesHelper( "testData", _sourceUri)
Test data full-path.

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:

  2. Create a generic query Disk v2 operation:

    Generic Disk v2 operation

  3. Amend your Test-Process to read test data from disk:

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

Directory: Fix project path + relative testData directory for this process.

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

Use DDP_FileFilter in the operation's parameters.

IMPORTANT: 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!

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

Process execution with the same four files from local disk.

Last updated