Score a test run
Step
scorecontrolChecks what a test run made against what its test case expects, and gives each check a pass or a fail with the reason.
At a glance
| Property | Value |
|---|---|
| Step name | score |
| Resource | ClusterStep (lumen.ai/v1alpha1) |
| Palette group, category | control, logic |
| Credits | 0 credits each time it succeeds |
| Side effects | no |
| Installation must provide | nothing |
Inputs
| Property | Value |
|---|---|
| Needs | nothing |
| Produces | fields |
| Works on | item one document at a time |
Needs and Produces are data types (file, text, fields, email). The editor offers a step only where what it needs is already on the path. See Documents and data.
Outputs
A later node references an output as {nodeId.field} in text, or nodeId.field in a condition.
| Output | Type |
|---|---|
passed | boolean |
score | number |
checks | array |
failed | number |
Settings
Set under config: on the flow node. Text settings may contain {nodeId.field} placeholders.
| Setting | Type | Default | Description |
|---|---|---|---|
checksrequired | list of object | - | ChecksminItems 1; maxItems 50 |
checks[].namerequired | string | - | Name is the metric, as results show it.minLength 1; maxLength 63 |
checks[].actualrequired | string | - | 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[].oprequired | string | - | 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[].expected | string | - | Expected is the value to check against, written here.maxLength 4000 |
checks[].expectedColumn | string | - | ExpectedColumn takes the expected value from the test case's column instead (run.case.<column>).maxLength 63 |
checks[].mode | string | "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 |
minScore | number | - | 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 |
The full JSON Schema of these settings: score.schema.json.
Example
Check the total
config
checks:
- actual: read.total
expected: "1170"
name: total
op: equals
Use it in a flow
A node that runs score goes under spec.nodes of a Flow. Give it any id, and list the next node ids in next.
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
Was this page helpful?