# Test run and history

> Try an automation against real data before it runs, read what every run did step by step, and find out why an automation paused and how to switch it back on.

Every automation has three tabs: <Ui>Edit</Ui>, <Ui>Test run</Ui> and <Ui>History</Ui>. The test run shows what the automation would do before it does anything. The history shows what it did, every run and every step.

## Test run

Open <Ui>Test run</Ui> and click <Ui>Start test run</Ui>. nexxus tries the automation as it stands in the form, unsaved changes included, against your real data. Nothing is saved or changed:

- <Ui>Run an action</Ui> only passes the pre-check, the same checks the action would pass for real.
- <Ui>Notify</Ui> and <Ui>Send mail</Ui> only prepare their message. Nobody gets anything.

<Screenshot src={shot_test_run} alt="The test run of the automation Critical security incident: it would have run 3 times in the last 7 days, the steps for three incidents and the notification that would go out" caption="Every step shows test. Below the steps, the notifications that would go out, with their title and text." />

What the result shows depends on the trigger:

| Trigger | The first line says |
|---|---|
| <Ui>A record is created</Ui> | how often it would have run in the last 7 days |
| <Ui>A record is changed</Ui> | the same, as an upper bound: <Ui>At most this often: the test run cannot see whether the field changed.</Ui> |
| <Ui>A condition holds</Ui>, every record | how many records match right now |
| <Ui>A condition holds</Ui>, count | <Ui>Right now it is 4.</Ui> |
| <Ui>On a schedule</Ui> with a source | how many records match right now |

Below that, <Ui>How the steps ran</Ui> shows each step for up to three matching records, and <Ui>These notifications would go out</Ui> lists every notification with its recipient, title and text. Without records, for a schedule without a source or a count, the steps run once without one.

If a step would fail, the test says <Ui>It does not run like this</Ui> and quotes the reason. Change the form and click <Ui>Again</Ui>. Once you change the form after a test, the result says <Ui>The form has changed since the test run.</Ui>

Some things the test cannot show:

- **Results of earlier steps.** Nothing is created, so `{{step2.id}}` has no value yet. Fields that use it are left out of the pre-check.
- **One notification per record.** The preview gathers the sample records as if they came in one run. A record trigger starts one run per record and notifies once for each.
- **Counting is capped** at 1,000. Above that the result says <Ui>Counted up to the test run's limit; there may be more.</Ui> A source without a timestamp cannot be counted by date: <Ui>This source has no timestamp; counted is what matches now.</Ui>

## History

<Ui>History</Ui> lists the latest runs, newest first: <Ui>The latest runs with the result of each step. Kept for 90 days.</Ui> nexxus keeps up to 500 runs per automation. <Ui>Reload</Ui> fetches new ones.

Each run shows:

- its status, when it started and its number (`#5`),
- what triggered it, for example <Ui>„P04-001 – Lagerplanung Hansa“ geändert (Ampel)</Ui> (changed, field Ampel); this line comes from the server and is in German for now,
- how many records it covered, and <Ui>triggered by run #12</Ui> when another automation's run caused it,
- for a failed or skipped run, the reason,
- every step that ran, with its number, its status and what it did.

<Screenshot src={shot_history_if} alt="Three runs of the automation Project status changes, each with If / else steps and which branch they took" caption="The steps of a branch that did not run are missing. Run #3 went through Then (steps 1 to 3), runs #4 and #5 through Else (steps 1, 4 and 5)." />

### What the statuses mean

| Status | Means |
|---|---|
| <Ui>succeeded</Ui> | every step ran. What the steps did is in effect: notifications sent, records created or changed. |
| <Ui>failed</Ui> | a step failed. The run stopped there, and nothing of it took effect. |
| <Ui>skipped</Ui> | the run did not start, for a reason nexxus checks before the first step. The reason is shown. |
| <Ui>running</Ui> | the steps are running right now. |

**A failed run is all or nothing.** The steps before the failed one show <Ui>succeeded</Ui>, because they did their part, but the run is rolled back as a whole: no notification goes out, no mail is sent and no record stays changed. Fix the cause and the next run does everything. The one exception is an action that writes to another system, through a connector for example: what it already sent out cannot be called back.

<Screenshot src={shot_history_failed} alt="Two runs of the automation Critical security incident: run #2 succeeded with three steps, run #1 failed at step 2 with the message Priorität 'HIGH' gibt es nicht" caption="Run #1 failed at step 2 because the priority was written in capitals. Run #2 ran after the fix and did all three steps." />

**A change that does not match <Ui>Only if</Ui> leaves no entry.** The history only lists runs. If you expected a run and see none, check the condition, and check whether the person the automation runs as may read the record.

### Why a run is skipped

| Reason shown | What happened |
|---|---|
| <Ui>Von einem eigenen Lauf ausgelöst.</Ui> | The change came from this automation's own run. An automation does not trigger itself. |
| <Ui>Die Kette aus Automationen endet nach 3 Gliedern.</Ui> | Three automations triggered each other in a row. The fourth does not run. |
| <Ui>Mehr als 60 Läufe in einer Stunde. …</Ui> | The limit <Ui>Maximum runs per hour</Ui> was reached. The automation pauses. |
| <Ui>Ein Lauf träfe 120 Datensätze, und die Automation ändert Daten oder schreibt Mails. …</Ui> | A single run would have covered more than 50 records with an action or a mail among its steps. The automation pauses. |
| <Ui>Die Person, der die Automation gehört, gibt es nicht mehr oder sie ist deaktiviert.</Ui> | The person it runs as is gone. The automation pauses. |

## When an automation pauses

nexxus pauses an automation instead of letting it run wild. A paused automation is switched off, the list shows it as <Ui>paused</Ui>, and the editor names the reason at the top, below <Ui>Runs as</Ui>: <Ui>Paused: …</Ui>. The error of the last failed run shows there too.

| Reason | Who is told |
|---|---|
| more runs in one hour than <Ui>Maximum runs per hour</Ui> allows (60 unless set otherwise) | the person it runs as, in the bell |
| one run would cover more than 50 records, and the steps change data or send mail | the person it runs as, in the bell |
| five runs in a row failed: <Ui>5 Läufe nacheinander gescheitert, zuletzt: …</Ui> | the person it runs as, in the bell |
| the person it runs as was deactivated or deleted | everyone with the permission `automation.manage`, for tenant automations |

The notification is titled with the name of the automation and <Ui>angehalten</Ui> (paused), and links to it.

A paused automation never switches itself back on. Fix the cause first: narrow the condition, raise the limit, correct the failing step, or pick another person under <Ui>Runs as</Ui>. Then switch on <Ui>Switched on</Ui> and save. The count of failed runs starts again at zero, and a trigger <Ui>A condition holds</Ui> takes stock afresh, so what matches at that moment does not fire.

## Next steps

<CardGrid>
  <LinkCard title="Recipes" href="/automations/recipes/" description="Six complete automations to copy." />
  <LinkCard title="Run automations for the tenant" href="/automations/administration/" description="Cron jobs, the permission, every limit in one table." />
</CardGrid>