Skip to main content
Feedback

Groovy testing outside the Boomi Enterprise Platform

There are tools available for testing Groovy scripts outside the Boomi Enterprise Platform.

Among these tools are the Groovy Swing console, a standalone utility, and plugins for popular Java IDEs including Eclipse and IntelliJ IDEA.

When testing outside the platform, you need to simulate the dataContext object by modifying your script to read data in from files on your local PC and write results to the console or back to disk. Groovy and Java syntax is very similar so there are few minor syntactical changes to make when switching, most notably any local method declarations.

Here is an example skeleton of a Java class to simulate operating on a single XML document. If you needed to test the script across multiple documents, adapt the script to read in multiple files from disk and iterate through them.

public class simpletest {

publicstatic void main(String[] args) throws Exception {

// Read in data from a local file
InputStream is = new FileInputStream("C:\\Test Data\.xml");

// Parse the data
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(is);


// YOUR SINGLE DOCUMENT LOGIC GOES HERE
// Output XML data to the Java conole
XMLOutputter outputter = new XMLOutputter();
System.out.print(outputter.outputString(doc));

}

}
note

Include all the contents from your local Runtime's <atom_installation_directory>/lib directory to your IDE's or console's classpath to simulate the classes available when running within the Runtime.