Assert functions - Manual - AxUnit-ST - AxUnit ST documentation package - AxUnit-ST,

AxUnit-ST CLI Tool (test)

Portfolio
SIMATIC AX
Product
AxUnit-ST
Software version
8.3.9
Edition
07/2025
Language
English (original)
Package Name
@ax/axunitst-docs

The Assert functions determine whether a test passes or fails the expected condition. The number of asserts inside a test is unrestricted. If one assert fails, the remaining asserts are not evaluated anymore.

Example:

{Test(value1 := 1, value2:= 2, exp := 3)}
FUNCTION PUBLIC AddingTwoNumbersReturnsTheSum
    VAR_INPUT
        value1  : INT;
        value2  : INT;
        exp     : INT;
    END_VAR
    VAR_TEMP
        result  : INT;
    END_VAR
    result := value1 + value2;
    AxUnit.Assert.Equal(result, exp);
END_FUNCTION