AssertEqual

AssertEqual 1:

The AssertEqual method can be used to verify the result of a test preparation step and, if an error occurs, to display a custom error message. The comparison of the expected value with the result of the preparation step takes place within the AssertEqual method itself. The AssertEqual method is based on the ANY data type. Since the parameters must be passed as typed values for this reason, the expected value must first be assigned to a corresponding typed variable and cannot be assigned directly within the call to the AssertEqual method.

Syntax

METHOD PUBLIC AssertEqual
VAR_INPUT
    anyActual :    ANY;
    anyExpected :  ANY;
    sMessage : STRING(255) := ''; // optional assert message
END_VAR

AssertEqual 2: Inputs

Name

Type

Description

anyActual

ANY

Value determined by executing the test case

anyExpected

ANY

Expected value for the test case

sMessage

STRING(255)

Error message if the test fails.

Sample

expectedValue:=<value>;
AssertEqual(anyActual:=<actual Value>, anyExpected:= <expectedValue>, message:= 'Error message to be displayed in the client!');

actual Value is the “calculated” result of the test case.