eval - Evaluate Expression

Evaluate an expression and use its result as the step’s pass/fail outcome and result value.

- command: eval <expression>
  [extractKey: <key>]

Argument

Description

expression

Expression to evaluate

key

Key in which to store the evaluated expression value

expression may reference any key set with define - Define user key, plus a fixed set of system keys (PRODUCT, VERSION, BOM_REV, DUT_ID, SERIAL_NUMBER, PLT_RUNNER_VERSION, PLT_OS_VERSION, TEST_PLAN_TITLE, PLT_IP_ADDRESS, RELEASE_UUID, PROJECT_UUID) and any key extracted by a prior value - Parse values, measure - Probe Measurement, or similar step. A key set with define overrides a system key of the same name. Reference a key by its bare name inside expression (e.g. SERIAL_NUMBER == "12345"); use %KEY% substitution only where the key must be expanded before the expression is parsed, such as inside a regular expression literal.

The step’s outcome depends on the type of the evaluated result:

  • A boolean result of true passes the step; false fails it.

  • A non-empty string or numeric result passes the step, and becomes the result value (stored under key if extractKey: is set).

  • An empty string result fails the step.

Supported operators:

Operator

Description

+

Addition, concatenation

-

Subtraction, Negation

/

Division

*

Multiplication

**

Power

%

Modulo

&

Bitwise And

|

Bitwise Or

^

Bitwise Xor

~

Bitwise Not

>>

Right shift

<<

Left shift

!

Inversion

&&

Logical And

||

Logical Or

?

Ternary True

:

Ternary False

??

Null coalescence

>

Greater than

<

Less than

<=

Less than or equal

>=

Greater than or equal

==

Equal

!=

Not equal

=~

Regex match

!~

Regex mismatch

in

Set membership, e.g. "a" in ("a", "b", "c")

Supported functions:

Function

Description

bytes(val1 [, val2] [, ...])

Build a string from one or more numeric byte values (each argument is truncated to a byte, 0-255).

hex(value)

Convert numeric value to a hexadecimal string (no leading 0x).

numeric(value [, unit])

Convert value to a numeric value. value may be a bool, number, numeric string, or a measurement result (voltage, current, resistance, power, or frequency). Optional unit (e.g. mV, mA, kOhm) scales a measurement result before returning it as a plain number.

utcTime([format [, timezone]])

Returns the current timestamp. If format is provided, the date is returned in the specified format using Golang Time Format; otherwise it defaults to YYYY-MM-DD. If timezone is provided (an IANA time zone name, e.g. America/Los_Angeles), the timestamp is rendered in that zone instead of UTC.

Examples