Script Evaluation
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:
- Calculating a date based on the current date, for use in a subsequent node.
- With other nodes, implementing looping to iterate through a set of nodes until an event successfully occurs (or a max iteration count has occurred).
- Testing the results of a previous node in a manner more complex than supported by the node.
Test Fields
optional The script to evaluate. This must be valid Perl code. This field allows for multi-line Perl code to be written. ExamplesEvaluate
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 The result of this evaluation will be that the edr_fields will be available to test in kpath tests. Examples
$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;
[{
"kpath": "BALANCE_TYPE"
, "value": "1"
, "type": "string"
},{
"kpath": "COSTS"
, "value": 1030
, "type": "integer"
}]