# Test

Use `type: test` to define a test MMT file. Open a test file in VS Code to get the **test runner** on the right (YAML stays on the left).

![Test runner — Simple HTTP test, Overview stats, and Report steps](../../screenshots/test-runner.png)

## YAML editor

Run glyphs appear in the left margin of the YAML pane:

| Control | What it does |
|---|---|
| {{btn:run}} on `type:` | Run the test through core (opens log output) |

## Test runner UI

### Top bar

| Control | What it does |
|---|---|
| `title` | Test title from `title:` (shown with the beaker icon) |
| {{btn:type-hierarchy-sub:Flow chart}} | Opens the flowchart view for the test steps |
| {{btn:edit:Edit Test}} | Switches to **edit mode** — see [Edit Test](./edit.md). Hidden while the runner has unsaved input changes |
| {{btn:warning:UNSAVED CHANGES}} | Appears instead of Edit Test when runner inputs have unsaved UI edits |

Input edits in the runner are **temporary**. They are used for Run, but they are not in the YAML until you **Save to YAML**. **Edit Test** writes the YAML; the runner does not.

If you edit the YAML while the runner has unsaved input changes, a dialog titled **Unsaved changes in UI** asks you to **Discard UI changes**. Dismiss the dialog to keep the runner as-is.

See also: [Flow chart](../../features/flow-chart.md)

### Run bar

| Control | What it does |
|---|---|
| {{btn:play:Run test}} | Runs the test flow. While running, turns into **Stop test**. Shortcut: **⌘Enter** (macOS) / **Ctrl+Enter** |
| **More** (chevron next to Run) | While idle: **Run in Core**, **Run in testlight** (opens a terminal with `testlight run <file> …` plus workspace env flags), **Clear**. While running: **Pause** / **Resume** (first), then the other More actions |
| {{btn:export:Export}} | Export the run report (HTML, MMT, Markdown, or JUnit XML). Disabled until a run completes |

**Run in Core** runs through the same engine but only shows start/stop in the UI (full step reports go to the Multimeter log). Use the status-bar badge menu for **Stop** or **Open file** while that run is active — see [Panels — Status bar](../../panels/index.md#status-bar).

**Pause** holds the run at the next abort checkpoint (same places **Stop** can cancel); **Resume** continues. Closing the tab while a UI run is in progress prompts to save — **Cancel** keeps the run; discarding or saving closes the tab and aborts.

### After a run

| Section | What you see |
|---|---|
| `inputs` | Runtime input values when the test defines `inputs:` |
| `outputs` | Extracted output values when the test defines `outputs:` |
| **Overview** | **PASSED**, **FAILED**, **TOTAL**, and **DURATION** summary cards — see [Reports](./reports.md) |
| **Report** | Step-by-step results with pass/fail status and timestamps — see [Reports](./reports.md#report-list) |

### Input and output documentation

Document test `inputs` / `outputs` in `description` with `<<i:name>>` / `<<o:name>>`. Leading `[...]` on inputs defines allowed values and ranges and enables a ⋯ picker on runner input fields — same syntax as API files.

Full guide (syntax, ranges, Doc tables, and UI effects): [Input and output documentation](../input-output-docs.md).

## Supported

- Step types: [call](./steps/call.md), [http](./steps/http.md), [run](./steps/run.md), [check](./steps/check.md), [assert](./steps/assert.md), [judge](./steps/judge.md), [if](./steps/if.md), [for](./steps/for.md), [repeat](./steps/repeat.md), [delay](./steps/delay.md), [js](./steps/js.md), [print](./steps/print.md), [var, const, let](./steps/variables.md), [setenv](./steps/setenv.md)
- Inline validation: [expect / require](./inline-expect.md) · [Operators](./operators.md) · [omit](./omit.md)
- [Stages](./stages/index.md) with parallel execution
- [import](./import.md) · [cache](./cache.md)

Multimeter can also run `.http`, `.https`, and `.bru` files as test flows through the optional VS Code **Open With...** editors. See [HTTP file](../../integration/http-file.md) and [Bruno](../../integration/bruno.md).

Sample:

```yaml
type: test
title: Simple HTTP test
description: Calls an HTTP endpoint directly and checks the response
steps:
  - http: https://test.mmt.dev/echo
    title: Send an echo request
    method: post
    body:
      message: hello world
    expect:
      status: 200
      body.body.message: hello world
```

## Test elements

- [Quick start](./quick-start.md) · [Edit Test](./edit.md) · [Reports](./reports.md) · [Input and output documentation](../input-output-docs.md) · [Operators](./operators.md) · [omit](./omit.md) · [Inline expect](./inline-expect.md) · [Report overview](../report/index.md) · [Write a test flow](../../tasks/write-test-flow.md)
- [import](./import.md) · [cache](./cache.md)
- [Steps](./steps/index.md) · [Stages](./stages/index.md)
- [Stage condition](./stages/stage-condition.md) · [Complete example](./complete-example.md) · [CLI](./cli.md) · [Reference](./reference.md)
