Zum Hauptinhalt springen

Score a test run

Schrittscorecontrol

Checks what a test run made against what its test case expects, and gives each check a pass or a fail with the reason.

Auf einen Blick​

EigenschaftWert
Schrittnamescore
RessourceClusterStep (lumen.ai/v1alpha1)
Palettengruppe, Kategoriecontrol, logic
Credits0 Credits bei jedem Erfolg
Externe Wirkungnein
Die Installation muss bereitstellennichts

Eingaben​

EigenschaftWert
Brauchtnichts
Liefertfields
Arbeitet aufitem einem Dokument nach dem anderen

Braucht und Liefert sind Datentypen (file, text, fields, email). Der Editor bietet einen Schritt nur dort an, wo das, was er braucht, schon auf dem Pfad liegt. Siehe Dokumente und Daten.

Ausgaben​

Ein späterer Knoten verweist auf eine Ausgabe als {nodeId.field} in einem Text oder als nodeId.field in einer Bedingung.

AusgabeTyp
passedboolean
scorenumber
checksarray
failednumber

Einstellungen​

Wird unter config: im Knoten des Flows gesetzt. Texteinstellungen dürfen Platzhalter wie {nodeId.field} enthalten.

EinstellungTypStandardwertBeschreibung
checkserforderlichlist of object-ChecksminItems 1; maxItems 50
checks[].nameerforderlichstring-Name is the metric, as results show it.minLength 1; maxLength 63
checks[].actualerforderlichstring-Actual is the field checked, as a condition names it: <node>.<field>, walking into a JSON answer (extract.reply.source). It is read from that node's own output.minLength 1; maxLength 200
checks[].operforderlichstring-Op is how: equals, contains, matches (a regular expression), json (the expected JSON is part of the value), changes (a change list against the expected list), count (a list's length or a number), exists.one of equals, contains, matches, json, changes, count, exists
checks[].expectedstring-Expected is the value to check against, written here.maxLength 4000
checks[].expectedColumnstring-ExpectedColumn takes the expected value from the test case's column instead (run.case.<column>).maxLength 63
checks[].modestring"equal"Mode is a changes check's: equal (exactly these changes, a change not expected is a wrong write and fails) or include (at least these).one of equal, include
minScorenumber-MinScore is the share of checks that must pass for the run to pass, from 0 to 1. Unset is 1: every check.minimum 0; maximum 1

Das vollständige JSON Schema dieser Einstellungen: score.schema.json.

Beispiel​

config
checks:
- actual: read.total
expected: "1170"
name: total
op: equals

Im Flow verwenden​

Ein Knoten, der score ausführt, steht unter spec.nodes eines Flow. Geben Sie ihm eine beliebige id und nennen Sie in next die ids der nächsten Knoten.

flow.yaml
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
name: score-example
namespace: tenant-acme
spec:
displayName: "Score a test run"
triggers:
- id: start
ref: {name: manual-run}
next: [score]
nodes:
- id: score
stepRef: {name: score}
config:
checks:
- actual: read.total
expected: "1170"
name: total
op: equals