Logic Op - Assert
Logic Operation - Assert
The Assert operation is used to perform logic checks within the test instance.
The pass/fail results will be written to the check_log
for the test instance.
If configured to do so, a failed check will result in the test instance being
aborted.
- Direction: INTERNAL
- From: N/A
- To: N/A
Attributes
The operation attributes are as follows.
Attribute
Type
Description
type
String
eval
expression
String
[Required] The expression to evaluate, typically referencing
$v
, $i
or $g
.
This attribute is always evaluated as an expression.
pass
String
Message to record in the test instance
check_log
if the expression evaluates true
.
Message will be logged with status
= pass
and with text
as specified.
(Default = ‘Assert tested TRUE.’)
This message may be specified as an expression.
fail
String
Message to record in the test instance
check_log
if the expression evaluates false
.
Message will be logged with status
= fail
and with text
as specified.
(Default = ‘Assert tested FALSE.’)
This message may be specified as an expression.
abort
String
Message to record in the test instance
check_log
if the expression evaluates false
.
Message will be logged with status
= abort
and with text
as specified.
This message may be specified as an expression.
The test instance will also be aborted in this case.
Note: If the abort
attribute is present, then the fail
attribute is ignored.
Example
This is an example entry within the operations
array:
{
"type": "assert",
"expression": "$i->{ReleaseCall}{initialCallSegment_cause} > 22",
"pass": "{'OK Cause ' . $i->{ReleaseCall}{initialCallSegment_cause} . ', is > 22.'}",
"fail": "{'Bad Cause ' . $i->{ReleaseCall}{initialCallSegment_cause} . ', <= 22.'}"
}
If the returned cause value from the preceding inbound ReleaseCall was > 22 (e.g. 32), then
the following would will be added to the test instance check_log
.
{
step: [current step index],
op_idx: [current operation index],
status => "pass",
text => "OK Cause 32, is > 22."
}
If the most recently returned ReleaseCall cause was 20, then the following entry would be
added to the test instance check_log
.
{
step: [current step index],
op_idx: [current operation index],
status => "fail",
text => "Bad Cause 20, is <= 22."
}