AssertTrue

AssertTrue 1:

The AssertTrue method can be used to indicate that the current test case has failed. Unlike the AssertEqual method, which compares the result to the expected value on its own, the comparison here must be performed in the test case’s application code, and the result of the comparison must be passed to the method as a Boolean value. The error message is passed in the sMessage parameter.

Syntax

METHOD PUBLIC AssertTrue
VAR_INPUT
    bCondition : BOOL
    sMessage : STRING(255) := '';
END_VAR

AssertTrue 2: Inputs

Name

Type

Description

bCondition

BOOL

A BOOL value that indicates whether the test was successful.

sMessage

STRING(255)

Error message if the test fails.

Sample:

AssertTrue(bCondition:=<condition>, sMessage:= 'Error message to be displayed in the client!');