Skip to content

Custom Logic Expressions

Complex test conditions are best configured using custom logic expressions that evaluate a runtime variable or the result of a key execution. Expressions are written and evaluated in Jinja.

Jinja logic expressions allow the use of several operators to run against the test-variable. All expressions must resolve to a Boolean value.

Warning

When tests use logic expressions, variable names are restricted to alphanumeric and underscore characters. Variable names are case-sensitive.

Jinja test expression evaluation

The system runs Jinja expressions through a compiler and uses the following process:

  1. The system compiles all JSON files when the node begins execution. This includes node files, data source files, and data sink files.
  2. When a specific test is run, the system compiles the test-logic value again to determine its Boolean result.
  3. If the expression resolves to True, then the system sets the test status to success. If the expression resolves to False, the test fails.

See File Evaluation Sequence and Tests Order of Execution for more information.

Logic expression examples

rowcount > 0 and rowcount < 1000
expected_value in [1,2,3,4] 
status not in [0,-1]
total == 1000 
status != 0 
status_message == 'Success!'