# ציון להרצת בדיקה

> בודק מה הרצת בדיקה הפיקה מול מה שמקרה הבדיקה מצפה לו, ונותן לכל בדיקה עבר או נכשל עם הסיבה.

Source: https://docs.go-lumen.ai/he/reference/steps/score

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `score` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | control, logic |
| **קרדיטים** | **0** קרדיטים בכל פעם שהוא מצליח |
| **השפעה חיצונית** | לא |
| **ההתקנה צריכה לספק** | כלום |

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | כלום |
| **מפיק** | `fields` |
| **עובד על** | item: מסמך אחד בכל פעם |

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו [מסמכים ונתונים](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#documents-and-data).

## פלט

צומת מאוחר יותר מפנה לפלט כ-`{nodeId.field}` בטקסט, או כ-`nodeId.field` בתנאי.

| פלט | סוג |
| --- | --- |
| `passed` | boolean |
| `score` | number |
| `checks` | array |
| `failed` | number |

## הגדרות

מגדירים תחת `config:` בצומת של התהליך. הגדרות טקסט יכולות להכיל מצייני מקום כמו `{nodeId.field}`.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `checks` (חובה) | list of object |  | Checks (minItems 1; maxItems 50) |
| `checks[].name` (חובה) | string |  | Name is the metric, as results show it. (minLength 1; maxLength 63) |
| `checks[].actual` (חובה) | 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[].op` (חובה) | 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) |

ה-JSON Schema המלא של ההגדרות: [score.schema.json](https://docs.go-lumen.ai/schemas/steps/score.schema.json).

## דוגמה

```yaml title="config"
checks:
- actual: read.total
  expected: "1170"
  name: total
  op: equals
```

## שימוש בתהליך

צומת שמריץ את `score` נכנס תחת `spec.nodes` של [Flow](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#the-flow-as-yaml). תנו לו כל מזהה, ורשמו ב-next את מזהי הצמתים הבאים.

```yaml title="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
```
