Test library

The test library (library.test) defines types for creating simple automated regression tests for scripts.

To use the test library, create a node of type Test Package. Use the New Test button to create a new test.

Write the test script under the Test tab. Here is a simple example.

 * Run a simple test

function main() {
  try {
    Test.message("Simple test");
    var x = 1;
    var y = 2;
    Test.test("Adding up", x + y);
  } catch(e) {
    Test.fail('Exception: ' + e);

if (!application.errorFound()){

Tests are run using the Test object. The text below the script input describes the available methods.

Save the node, and click on the Basic tab for options to run the test.

When you run the test, it will tell you Expected results not found. If the test outputs look correct, use the Copy actuals button to copy the actual test results as the expected results. If you want to set expected results before running the code, you can do so using the Expected tab.

The tests detect if any of the inputs have changed, have options to re-run tests automatically, and options to select multiple tests to run.