OTX Reference  
OpenTestSystem.Otx.Extensions.Assertion.Actions.Assert Class Reference

Evaluate assertions. More...

Inheritance diagram for OpenTestSystem.Otx.Extensions.Assertion.Actions.Assert:
Inheritance graph

Public Attributes

BooleanTerm condition
 The expression to evaluate More...
 
StringTerm errorMessage
 An error message which may be included in the report to the runtime system, if the assertion fails More...
 
- Public Attributes inherited from OpenTestSystem.Otx.Core.Actions.ActionRealisation
OtxLink validFor
 Validity of ActionRealisation. More...
 

Detailed Description

Evaluate assertions.

If the runtime is configured to evaluate assertions, it evaluates the given boolean expression. If the expression evaluates to true, nothing happens. If the expression evaluates to false, the execution of OTX procedure will be stopped (the exact runtime behaviour is unspecified), and the failed assertion is reported to the runtime system (out of OTX scope). The errorMessage term, if present, will only be evaluated when the assertion failed. In particular, the errorMessage term cannot throw any exceptions unless the assertion failed. If the runtime is configured not to evaluate assertions, the Assert action does nothing. In particular, the condition and errorMessage terms will not be evaluated, and thus cannot throw any exceptions.

Syntax
Assertion.Assert(BooleanTerm condition, StringTerm errorMessage);
StringTerm errorMessage
An error message which may be included in the report to the runtime system, if the assertion fails
Definition: Assertion.cs:151
BooleanTerm condition
The expression to evaluate
Definition: Assertion.cs:141
Example
// Local Declarations
// Flow
Assertion.Assert(1 == 1, "the expression evaluates to true");
Assertion.Assert(1 != 1, "the expression evaluates to false");
Assertion.Assert((1/0) == 0, "an exception occurs while evaluating the boolean expression");

Member Data Documentation

◆ condition

BooleanTerm OpenTestSystem.Otx.Extensions.Assertion.Actions.Assert.condition

The expression to evaluate

◆ errorMessage

StringTerm OpenTestSystem.Otx.Extensions.Assertion.Actions.Assert.errorMessage

An error message which may be included in the report to the runtime system, if the assertion fails