Chapter 67. Expression syntax in test scenarios

The test scenarios designer supports different expression languages for both rule-based and DMN-based test scenarios. While rule-based test scenarios support the MVFLEX Expression Language (MVEL) and DMN-based test scenarios support the Friendly Enough Expression Language (FEEL).

67.1. Expression syntax in rule-based test scenarios

Rule-based test scenario supports the following built-in data types:

  • String
  • Boolean
  • Integer
  • Long
  • Double
  • Float
  • Character
  • Byte
  • Short
  • LocalDate
Note

For any other data types, use the MVEL expression with the prefix #.

Follow the BigDecimal example in the test scenario designer to use the # prefix to set the java expression:

  • Enter # java.math.BigDecimal.valueOf(10) for the GIVEN column value.
  • Enter # actualValue.intValue() == 10 for the EXPECT column value.

You can refer to the actual value of the EXPECT column in the java expression to execute a condition.

The following rule-based test scenario definition expressions are supported by the test scenarios designer:

Table 67.1. Description of expressions syntax

OperatorDescription

=

Specifies equal to a value. This is default for all columns and is the only operator supported by the GIVEN column.

=, =!, <>

Specifies inequality of a value. This operator can be combined with other operators.

<, >, <=, >=

Specifies a comparison: less than, greater than, less or equals than, and greater or equals than.

#

This operator is used to set the java expression value to a property header cell which can be executed as a java method.

[value1, value2, value3]

Specifies a list of values. If one or more values are valid, the scenario definition is evaluated as true.

expression1; expression2; expression3

Specifies a list of expressions. If all expressions are valid, the scenario definition is evaluated as true.

Note

An empty cell is skipped from evaluation. To define an empty string, use =,[], or ;. To define a null value, use null.

Table 67.2. Example expressions

ExpressionDescription

-1

The actual value is equal to -1.

< 0

The actual value is less than 0.

! > 0

The actual value is not greater than 0.

[-1, 0, 1]

The actual value is equal to either -1 or 0 or 1.

<> [1, -1]

The actual value is neither equal to 1 nor -1.

! 100; 0

The actual value is not equal to 100 but is equal to 0.

!= < 0; <> > 1

The actual value is neither less than 0 nor greater than 1.

<> <= 0; >= 1

The actual value is neither less than 0 nor equal to 0 but is greater than or equal to 1.

Note

You can refer to the supported commands and syntax in the Scenario Cheatsheet tab on the right of the rule-based test scenarios designer.

67.2. Expression syntax in DMN-based scenarios

The following data types are supported by the DMN-based test scenarios in the test scenarios designer:

Table 67.3. Data types supported by DMN-based scenarios

Supported data typesDescription

numbers & strings

Strings must be delimited by quotation marks, for example, "John Doe", "Brno" or "".

boolean values

true, false, and null.

dates and time

For example, date("2019-05-13") or time("14:10:00+02:00").

functions

Supports built-in math functions, for example, avg, max.

contexts

For example, {x : 5, y : 3}.

ranges and lists

For example, [1 .. 10] or [2, 3, 4, 5].

Note

You can refer to the supported commands and syntax in the Scenario Cheatsheet tab on the right of the DMN-based test scenarios designer.