Saltar al contenido principal

Score a test run

Pasoscorecontrol

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

De un vistazo​

PropiedadValor
Nombre del pasoscore
RecursoClusterStep (lumen.ai/v1alpha1)
Grupo de la paleta, categoríacontrol, logic
Créditos0 créditos cada vez que tiene éxito
Efectos externosno
La instalación debe aportarnada

Entradas​

PropiedadValor
Necesitanada
Producefields
Trabaja sobreitem un documento cada vez

Necesita y Produce son tipos de datos (file, text, fields, email). El editor ofrece un paso solo donde lo que necesita ya está en el camino. Consulta Documentos y datos.

Salidas​

Un nodo posterior se refiere a una salida como {nodeId.field} en un texto, o nodeId.field en una condición.

SalidaTipo
passedboolean
scorenumber
checksarray
failednumber

Ajustes​

Se definen bajo config: en el nodo del flujo. Los ajustes de texto pueden contener marcadores de posición como {nodeId.field}.

AjusteTipoValor por defectoDescripción
checksobligatoriolist of object-ChecksminItems 1; maxItems 50
checks[].nameobligatoriostring-Name is the metric, as results show it.minLength 1; maxLength 63
checks[].actualobligatoriostring-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[].opobligatoriostring-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

El JSON Schema completo de estos ajustes: score.schema.json.

Ejemplo​

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

Úsalo en un flujo​

Un nodo que ejecuta score va bajo spec.nodes de un Flow. Dale cualquier id y enumera en next los ids de los nodos siguientes.

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