Operation Tests

Overview

A number of operations support a tests structure which provides an easy-to-use mechanism for flows to perform checks on the results associated with each operation.

Operations which support a built-in tests array include the following:

The tests structure for each of these is identical. It is an array of Operation Test Objects each with the following attributes. Note that all attributes in the tests array may be expressions. Use curly braces to request expression expansion, e.g. { ‘A’ . ‘B’ }.

Common Attributes

Attribute Type Description
.kpath String [Required] This is the "kpath" which locates the response element which is to be validated by this check. Refer to the KPath documentation for more information on KPath syntax. Refer to the documentation for each operation for more information on the structure of the response object which can be accessed by the KPath.
.type String [Required] The type of test to perform. Supported test types are string, integer, exists, defined, regex, timestamp, size, ordered_str_array, or boolean.

Each type of Operation Test has additional parameters.

String Test Attributes

Attribute Type Description
.value String [Required] For a string test, you must specify the expected value to check against the actual returned value matched by the KPath. To check that a returned string is not present, specify null for the expected value.
.abort_on_fail Integer If abort_on_fail is = 1 then failure to match this Operation Test will abort the Flow Execution.
(Default = 0)

Integer Test Attributes

Attribute Type Description
.value Integer [Required] For a integer test, you must specify the expected value to check against the actual returned value matched by the KPath. To check that a returned integer is not present, specify null for the expected value.

Exists Test Attributes

Attribute Type Description
.value Integer [Required] For an exists test, the value field specifies if you are checking for the existance or the non-existance of the actual returned value matched by the KPath.
If you specify a value of 1 then the test will pass if and only if the KPath entry exists – noting that existance with an undef value still counts as existance.
If you specify a value of 0 then the test will pass if and only if the KPath entry does not exist – noting that existance with an undef value still counts as existance.

Defined Test Attributes

Attribute Type Description
.value Integer [Required] For a defined test, the value field specifies if you are checking for the definition or the non-definition of the actual returned value matched by the KPath.
If you specify a value of 1 then the test will pass if and only if the KPath entry exists and is defined – i.e. is not the undef value.
If you specify a value of 0 then the test will pass if and only if the KPath entry does exist but is not defined – i.e. is present but is the undef value.

RegEx Test Attributes

Attribute Type Description
.pattern Integer [Required] For a regex test, you must specify the expected pattern to check against the actual returned value matched by the KPath. To check that a returned value is not present, specify null for the expected pattern.

Note that pattern matching is always case-sensitive.

Timestamp Test Attributes

Attribute Type Description
.value String [Required] For a timestamp test, you must specify the expected value to check against the actual returned value matched by the KPath. To check that a returned timestamp is not present, specify null for the expected value.

All timestamps are in 14 character YYYYMMDDHHMMSS format or in SOAP format YYYY-MM-DDTHH:MM:SSZ or YYYY-MM-DDTHH:MM:SS. The specified value for a timestamp Operation Test may be either:

In either case, a “leeway” value in seconds may also be given - allowing for a “fuzzy” match.

Examples:

Size Test Attributes

Attribute Type Description
.size Integer [Required] For a size test, you must specify the expected size of the ARRAY element that will be matched by the KPath.

Note that for a size test, an actual ARRAY value match by the KPath will have value equal to the number of array elements it contains. An undefined value has actual size = 0. A SCALAR or OBJECT value matched by the KPath is considered to have actual size = 1.

Ordered String Array Test Attributes

Attribute Type Description
.value Array of Strings [Required] For an ordered_str_array test, the expected value is an ARRAY of STRING values which must each match exactly the actual response values in number, sequence and value.

Boolean Test Attributes

Attribute Type Description
.value Boolean Required For a boolean test, you must specify the expected value to check against the actual returned value matched by the KPath. To check that a returned boolean is not present, specify null for the expected value.

Range Test Attributes

Attribute Type Description
.min Integer Required For a range test, you must specify the expected min to check against the actual returned value matched by the KPath.
.max Integer Required For a range test, you must specify the expected max to check against the actual returned value matched by the KPath.