Documentation

Testing Your Code in the UI

Abstract

SummaryInformation on using the Code Engine UI, including how to get sample data from your input and how to test run your code against that sample data.

As you write your code in the Code Engine, it is useful to see sample event data and then test your code on these samples. To this end, the Code Engine provides a "Get Sample" button that pulls in a real event object that the system received, shown as JSON in the Sample text area.

getsample.png

Press the "Run Test" button to simulate the current code on the sample event. The resulting event appears in the corresponding “Result” text area.

Check the "Also test mapping" option to run the resulting event through the mapper - this will validate for existing mappings, correct data type selections, and more.

Tip

The run-time indicator shows the execution time of your code on the sample event. Providing an efficient transform function can significantly improve the rate of transformed events, since transforms typically run on millions of events.

Running your code in this manner doesn’t actually affect any events. The “Get Sample” and “Run Test” workflow is purely a sandbox for you to tune your code. Additionally, the Sample Event text area is completely user-modifiable, meaning you can start with a sample event, modify the keys and values in the JSON directly, and then test your code on the modified object.

Note

Events are sampled as they are received by Alooma, before having been transformed by the Code Engine and Mapper.

You can test your code via the Code Engine UI, or you can test your code programmatically.

Search results

    No results found