Testing Your Expressions

Before publishing your workflow, we strongly recommend testing your expressions. This helps ensure your configuration behaves as expected.

You have two convenient ways to test your expressions in JWT:

Both serve the same purpose: previewing the result of your expression in a safe environment before going live. Testing your expressions before publishing helps avoid unnecessary issues and gives you confidence that your automation will behave exactly as intended.

Expression Test Page

For more advanced testing, head to:

Jira Administration → Manage apps → Jira Workflow Toolbox → Expression test page

Here you can:

  • Run expressions in a sandboxed environment

  • Test against any issue that are visible to you

  • Use all the different parsing modes (e.g., logical expressions, Jira expressions)

  • Select a different user for test execution using the "Run as" field

This is especially useful if your expression behavior depends on user permissions or roles.


Built-in Expression Preview

When editing a JWT workflow function, you can test your expression directly in the JWT expression editor. This built-in preview instantly shows you the result based on the current issue context, making it ideal for quick validation without leaving your configuration screen.

However, this method does not support changing the execution user, it always runs the expression as the currently logged-in user.

Five steps to test your expression

  1. Type in your expression or select one of the built-in examples.

    The Expression test page does not support all field codes. Field codes for e.g. Temporary fields, are not supported.

  2. Click on the Run button (play button) 

  3. Select an issue you want to test your expression with.

  4. Confirm your selection by clicking on Run

  5. Check the resulting output or analyze the errors.

    Exp_out.PNG

Syntax check

Before running your expression against a certain issue, it's recommended to check if the syntax is correct.

The syntax check button shows if the current expression in the input field is syntactically correct check-green-64-64.png  or not check-red-64-64.png . The background check runs at least one second after the last input, but you can also push the Syntax button for instant results.

The run button

ParserField4RunButton.png

By clicking on the Run button, a test expression panel is displayed under your expression. To test your expression, do the following:

  1. Select an issue that you want to test your expression with (as the current issue).

  2. Click on Run

Error message

Even if the syntax of the expression is correct, it may happen that the expression result is erroneous, e.g. when fields are empty.

In the example below the value of the custom number field "cf10041" is returning a value which is not valid parameter for the function substring().

image2020-8-11_9-43-15.png

Output of different data types

Depending on the Parsing modes and the expression itself, different Data types are being returned as a result of the expression.

General mode

Expressions written in the General mode will return texts.

GeneralMode.png

Logical mode

Expressions written in the Logical mode will return a boolean value of true or false.

LogicalMode.png

Jira expression mode

Expressions written in the Jira expression mode will return objects based on Data types (Jira expressions).

JiraExpressionMode.png

Testing a complex expression

When composing complex expressions, e.g. in Logical mode or the Jira expression mode, where you compare values we recommended to:

  1. Create individual expressions for the operands of the comparison.

  2. Test each expression separately within the selected Parsing modes.

  3. Merge the individual expressions and test the complete expression