> ## Documentation Index
> Fetch the complete documentation index at: https://developers.redo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# testAutomation

> Run the workspace's current, uncommitted automation once against a scenario and return what happened. Nothing is stored and nothing real happens: no messages are sent and no records change. Null if the workspace doesn't exist. INVALID while the document has an ERROR diagnostic or can't run; INVALID_SCENARIO, with the failing fields, for a scenario that doesn't match `schemas/scenario` in `automationCatalog`.

**Required scopes:** [`automations_read`](/docs/api-reference/v3/reference/scopes#scope-automations_read)

## Arguments

**scenario** *required*

The trigger's event as `payload`, and answers for what the run looks up or waits for. Read `schemas/scenario` in `automationCatalog`.

**workspaceId** `ID!` *required*

The workspace to run.

## Returns

**testAutomation**

What one test run of a workspace did. Nothing it did was stored or performed.

**fields**

**failure**

Why the run failed; null unless `status` is FAILED.

**fields**

**message** `String!` *required*

The error the run stopped on.

**stepId** `String`

The step that failed, or null for the run as a whole.

**logs**

What each Function step's code logged, by step id.

**records**

The scenario's records after the run, with the steps' writes applied, by record id.

**rejection** `String`

Why the automation declined to run; null unless `status` is REJECTED.

**status** *required*

Where the run ended. WAITING when it waits on something the scenario never answers; see `waitingOn`.

**steps** *required*

The steps the run executed, in order, with their inputs, outputs and effects, as in `AutomationRun.steps`.

**fields**

**effects** *required*

Side effects the step performed, each with its result.

**finishedAt**

When the step finished; null while it runs or waits.

**inputs**

The step's evaluated config.

**kind** `String!` *required*

The step's kind.

**note** `String`

A note the step left, such as why it was skipped.

**outcome** `String`

completed, disabled, failed or cancelled; null while running.

**output**

What the step produced, as later steps read it.

**port** `String`

The output port the run left the step by.

**startedAt** *required*

When the step started.

**stepId** `String!` *required*

The step's id in the automation's script.

**unanswered** `[String!]!` *required*

Lookups the scenario didn't answer, as `resolver.field`; the run used each field's fallback. Answer them in the scenario's `records` or `resolvers`.

**waitingOn** `String`

What a WAITING run waits for that the scenario never answered, such as an event.

## Example

```graphql theme={null}
query {
  testAutomation(scenario: "...", workspaceId: "...") {
    logs
    records
    rejection
    status
    unanswered
    waitingOn
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.