AssertEqual

AssertEqual 1:

The AssertEqual method can be used to verify whether the result of a test case matches an expected value. If this is not the case, an error message is passed. 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.