Chapter 70. 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).
70.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
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:
Operator | Description |
---|---|
= | 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. |
When evaluating a rule-based test scenario, an empty cell is skipped from the evaluation. To define an empty string, use =
,[]
, or ;
and to define a null value, use null
.
Expression | Description |
---|---|
-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. |
You can refer to the supported commands and syntax in the Scenario Cheatsheet tab on the right of the rule-based test scenarios designer.
70.2. Expression syntax in DMN-based test scenarios
The following data types are supported by the DMN-based test scenarios in the test scenarios designer:
Supported data types | Description |
---|---|
numbers & strings |
Strings must be delimited by quotation marks, for example, |
boolean values |
|
dates and time |
For example, |
functions |
Supports built-in math functions, for example, |
contexts |
For example, |
ranges and lists |
For example, |
When evaluating a DMN-based test scenario, an empty cell is skipped from the evaluation. To define an empty string in DMN-based test scenarios, use " "
and to define a null value, use null
.
You can refer to the supported commands and syntax in the Scenario Cheatsheet tab on the right of the DMN-based test scenarios designer.