Script Evaluation

This node allows for a test flow to execute a Perl fragment as part of a test flow. By executing Perl fragments within the context of a flow execution a test can perform actions outside the feature set of the standard operations.

Some uses of this node include:


Test Fields

Evaluate

optional

The script to evaluate. This must be valid Perl code. This field allows for multi-line Perl code to be written.

Examples

  • This is an example of setting a variable to be tomorrow, so that it can be used later:
use Time::Piece;
use Time::Seconds; 
$v->{now} = Time::Piece->new;
$v->{now} = $v->{now} + ONE_DAY;
$v->{mytime} = $v->{now}->strftime('%Y%m%d010000');

Tests

optional

A JSON array fragment defining the kpath tests to run. Please refer to the kpath documentation in the user guide for more information on kpath tests. The tests are executed against the result of the evaluation given in the "Evaluate" field.

For example if the following script evaluation is run after an OCNCC EDR Lookup node then the OCNCC EDR found will be available in $v->{CcsEdrsForCli}, and the contents can be found in $v->{CcsEdrsForCli}[0]{EXTRA_INFORMATION}:

my %edr_fields = split /[=\|]/, $v->{CcsEdrsForCli}[0]{EXTRA_INFORMATION}; \\%edr_fields;

The result of this evaluation will be that the edr_fields will be available to test in kpath tests.

Examples

  • This is an example of two checks, both of which use kpaths to extract out the key from the hash result from the evaluation to check it:
[{
    "kpath": "BALANCE_TYPE"
    , "value": "1"
    , "type": "string"
},{
    "kpath": "COSTS"
    , "value": 1030
    , "type": "integer"
}]