---
title: OpenFlange Portable Tests
spec: openflange.org/test/v0.1
version: 0.1.0-draft
status: experimental
updated: 2026-12-03
summary: A runner-independent test format for pipes and pipelines — inline or file inputs, parameter overrides, expected outputs per port, status and error assertions, ordering, tolerances and schema assertions.
---

# OpenFlange Portable Tests v0.1

This specification defines a runner-independent test format for OpenFlange pipes and pipelines: a YAML file that supplies inputs and parameters for a run and states the expected status, error code and output of each port. It defines how expected and actual output are compared, including ordering, exact numbers, tolerances and schema assertions.

This document is published at <https://openflange.org/test/v0.1>. Its identifier, `openflange.org/test/v0.1`, is that URL without the scheme, and is the value documents of this kind carry in `spec:`.

## At a glance

- **Identifier:** `openflange.org/test/v0.1` — the value of `spec:` in documents of this kind
- **Published at:** <https://openflange.org/test/v0.1> (raw Markdown: <https://openflange.org/test/v0.1.md>)
- **Version:** 0.1.0-draft
- **Status:** experimental (feature maturity labels are listed in the document)
- **Updated:** 2026-12-03
- **JSON Schemas (2020-12):**
  - <https://openflange.org/schemas/test-v0.1.schema.json>
- **Related specifications:**
  - Pipe: <https://openflange.org/pipe/v0.1>
  - Pipeline: <https://openflange.org/pipeline/v0.1>
  - Standard library: <https://openflange.org/std/v0.1>
  - CLI protocol: <https://openflange.org/cli/v0.1>

## Minimal example

The smallest useful test file, `tests/basic.test.yaml` beside a manifest:

```yaml openflange:test
spec: openflange.org/test/v0.1
tests:
  - name: lowercases mixed case
    inputs:
      text: {values: ["Alice@Example.COM"]}
    expect:
      outputs:
        text: {values: ["alice@example.com"]}
```

## 1. Introduction

A pipe's contract says what its ports look like; a test says what it
*does*. Portable tests are data files that any conformant runner can
execute against any implementation of a pipe — the same file tests a
Starlark script, an R executable and a remote HTTP service, because it only
talks about ports, parameters and outcomes.

Portable tests serve three purposes: authors ship them with a pipe;
registries and consumers can re-run them; and the specification's own
**conformance suite** (`conformance/runs/` in the specification
repository) is written in this format. They complement, and do not replace,
an implementation's native unit tests.

### 1.1 Conventions

The key words MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT,
RECOMMENDED, MAY and OPTIONAL are to be interpreted as described in RFC 2119
and RFC 8174 when, and only when, they appear in capitals.

Fenced examples whose info string contains `openflange:<kind>` are normative
and machine-checked against
`https://openflange.org/schemas/test-v0.1.schema.json`.

### 1.2 Citing this document

Normative statements are cited by **section number**, for example
`test/v0.1 §4.2`, and numbered or bulleted rules within a section by their
position, for example `test/v0.1 §4.2(3)`. Section numbers are stable
within v0.1: sections are appended, never renumbered. Every heading has a
stable fragment identifier derived from its text (lower-cased; characters
other than letters, digits, spaces, hyphens and underscores removed; spaces
replaced by hyphens), so a section is addressable as
`https://openflange.org/test/v0.1#<fragment>`. Cross-references to other
OpenFlange specifications are absolute URLs of that form. This document
does not rely on images; its diagrams are text.

## 2. Terminology and maturity

The terms **pipe**, **source**, **sink**, **pipeline**, **subpipeline**,
**node**, **port**, **stream**, **run** and **dataset** are defined in the
[Pipe specification, section 2](https://openflange.org/pipe/v0.1#2-terminology); **workflow**
is reserved and not used here. In this document:

- **test file** — a YAML document in this format.
- **target** — the pipe or pipeline under test.
- **test** — one entry of `tests`: one run of the target and its
  assertions.
- **test runner** — the software executing test files (the reference CLI:
  `openflange test`).

| Feature | Maturity |
|---|---|
| Test files, discovery, targets (3) | experimental |
| Inputs: `values`, `file`, `text`, `disconnected` (4) | experimental |
| Expectations: `status`, `error`, per-port `values`/`file`, `ordered`, `tolerance`, `count`, `schema`, `disabled` (5) | experimental |
| Comparison rules (6) | experimental |
| Tests over `windows` ports | proposed (window framing) |
| Pinned batch settings: `batch` on a test (3.4) | experimental (feature `batch`) |
| Structural assertions on `text` outputs: `minLength`, `maxLength`, `pattern` (5) | experimental |

Nothing is `stable` or `deprecated` in v0.1.

## 3. Test files

### 3.1 Location and discovery

A test file is named `tests/<anything>.test.yaml`, in a `tests` directory
beside a manifest, or `openflange.test.yaml` beside a manifest.
`openflange test <pipe>` runs the test files of that pipe;
`openflange test <dir>` runs every `*.test.yaml` file found recursively
under the directory (skipping `node_modules` and directories beginning
with `.`). A test file MAY live anywhere if it names its target explicitly.

Test files are parsed with the safe YAML rules of the
[Pipe specification, section 4.2](https://openflange.org/pipe/v0.1#42-safe-yaml); a file
that does not parse or does not match the schema is a test error
(`E_MANIFEST`), reported for the file as a whole.

### 3.2 Structure

```yaml openflange:test
spec: openflange.org/test/v0.1
pipe: ..
tests:
  - name: lowercases mixed case
    parameters: {}
    grants: {}
    inputs:
      text: {values: ["Alice@Example.COM"]}
    expect:
      status: completed
      outputs:
        text:
          values: ["alice@example.com"]
          ordered: true
          count: 1
```

| Key | Required | Meaning |
|---|---|---|
| `spec` | yes | The constant `openflange.org/test/v0.1`. |
| `pipe` | no | The target (3.3). |
| `tests` | yes | Non-empty list of tests. |

Each test:

| Key | Required | Meaning |
|---|---|---|
| `name` | yes | Unique within the file; used in reports. |
| `description` | no | Free text. |
| `parameters` | no | Parameter values for the target (literals). Unset parameters take their defaults. |
| `grants` | no | Permissions granted to the run, in the shape of the Pipe specification's `permissions`. Default: none. |
| `trusted` | no | `true` runs the test in explicit trusted mode instead of listing grants. A test runner MUST NOT enable it for tests that do not ask for it, and SHOULD require the invoker to allow trusted tests at all. |
| `batch` | no | Batch settings pinned for this test: `{maxItems, maxWaitMs}` (3.4). |
| `inputs` | no | Map of input port name to input (4). |
| `expect` | no | Assertions (5). Default: the run completes. |

### 3.3 Target

`pipe` is a **reference** to the target, resolved relative to the directory
of the test file:

- a path to a directory containing `OPENFLANGE.md`, or to a manifest file;
- a path to a pipeline file (`pipeline.yaml`), tested as a standalone
  pipeline with inferred ports;
- any other pipe reference of the Pipeline specification — in particular
  `std:<name>`, which is how the standard library's own tests are written.

When `pipe` is omitted, the target is the manifest in the **parent
directory** (`..`) for a file under `tests/`, and the manifest in the
**same directory** (`.`) for `openflange.test.yaml`.

Each test is one independent run of the target: no state is shared between
tests, and their order is not significant.

### 3.4 Batch settings

A pipe that declares batch mode
([Pipe specification, section 5.7](https://openflange.org/pipe/v0.1#57-batch-mode))
must give the same output however its input is sliced. A test MAY **pin
the batch settings** of its run so that the same expectations can be
asserted under different slice sizes:

```yaml
tests:
  - name: one item per slice
    batch: {maxItems: 1}
    inputs: {email: {values: ["a@x.io", "b@x.io", "c@x.io"]}}
    expect: {outputs: {domain: {values: ["x.io", "x.io", "x.io"]}}}
  - name: everything in one slice
    batch: {maxItems: 100}
    inputs: {email: {values: ["a@x.io", "b@x.io", "c@x.io"]}}
    expect: {outputs: {domain: {values: ["x.io", "x.io", "x.io"]}}}
```

- `batch` has the shape and the meaning of a node's `batch` settings
  ([Pipeline specification, section 3.8](https://openflange.org/pipeline/v0.1#38-node-batch-settings)),
  applied to the **target**: `maxItems` and/or `maxWaitMs`, which may only
  tighten what the target declares. Without `batch`, the target's declared
  settings apply.
- It is a consumer-side setting like any other, so the rules of 5.1 hold:
  settings that loosen the declaration, or `batch` for a target that does
  not declare batch mode (including every composite pipe and every
  pipeline file), make the test observe `status: failed` with `E_PARAM`.
- Test inputs given as `values` or `file` are available at once, so with a
  pinned `maxItems: n` a runner that takes all immediately available items
  delivers slices of exactly `n` items and one final shorter slice. A test
  MUST NOT depend on that: the delivery rule permits shorter slices, and
  the point of pinning is to vary the slicing, not to assert it. The
  format has no assertion on slice boundaries, deliberately.
- An invoker MAY supply batch settings for a whole test run (the
  reference CLI: `openflange test --batch <maxItems>[,<maxWaitMs>]`). They
  apply only to tests that pin no `batch` of their own and whose target
  declares batch mode — a test's own `batch` always wins — so that one
  command re-runs a suite at another batch size without failing the
  tests of pipes that have no batch mode.
- Authors of batch-mode pipes SHOULD run their expectations at least with
  `maxItems: 1`, with a small size that leaves a remainder, and with a size
  larger than the input.

## 4. Inputs

Each entry of `inputs` supplies one input port with exactly one of:

| Form | Meaning |
|---|---|
| `{values: [v1, v2, …]}` | A stream of items: each list element is one item (one NDJSON line). `{values: []}` is a **connected, empty** stream. Valid for `records`, `values` and `windows` ports (for `windows`, each element is a window frame). |
| `{file: path}` | The stream is the bytes of the file, in the port's media type. The path is relative to the test file and MUST NOT leave the directory tree of the test suite (`E_PATH`). |
| `{text: "…"}` | The stream is the UTF-8 encoding of the string. Intended for `text` ports; on an NDJSON port the string is the raw NDJSON. |
| `{disconnected: true}` | The (optional) input is left **disconnected**. |

Rules:

- Every **required** input of the target MUST be supplied; a missing one is
  a test error, not a failed assertion.
- An **optional** input that is not listed is disconnected, exactly as
  with `disconnected: true`. `disconnected: true` on a required input is a
  test error.
- "Connected and empty" (`values: []`) and "disconnected" are different
  situations and pipes may behave differently in each; tests exist for
  both.
- YAML numbers in `values` are converted to JSON numbers. YAML parsers
  commonly cannot represent integers beyond 64 bits or decimals beyond
  double precision; **tests that need exact large or high-precision numbers
  MUST use `file`**. A test runner MUST NOT silently round a number it
  reads from a test file; if it cannot represent a literal exactly it MUST
  report a test error.

## 5. Expectations

```yaml
expect:
  status: failed
  error: {code: E_RUNTIME}
  outputs:
    email:
      schema: {type: string}
    rejected:
      disabled: true
```

### 5.1 Status and error

- `status` — the expected terminal state of the run: `completed`
  (default), `failed` or `cancelled`.
- `error` — when the run is expected not to complete: `code` is compared
  with the code of the run's error. Optional `node` and `port` are compared
  when given. Messages are never compared.

**Validation errors count as failures.** If the target does not compile
for the test's parameters and grants — a parameter out of bounds
(`E_PARAM`), an ungranted permission (`E_PERMISSION`) — the test observes
`status: failed` with that code, although no run started. This makes
parameter bounds and permission refusals testable in the same format.

A mismatch between the expected and the actual status fails the test
regardless of outputs.

### 5.2 Outputs

**Connection.** Every declared output of the target is **connected and
collected** by the test runner, whether or not it appears under
`expect.outputs`, with one exception: an optional output marked
`disabled: true` is left disconnected, so that the pipe's behaviour without
it can be tested. `disabled: true` on a required output is a test error. An
output that is connected but has no assertions is simply drained.

Assertions for one output port (all optional, all must hold):

| Key | Meaning |
|---|---|
| `values` | The expected items, compared as in section 6. |
| `file` | The expected stream, read from a file: parsed as items for `records`, `values` and `windows` ports; compared **byte for byte** for `text` and `binary` ports. Mutually exclusive with `values`. |
| `ordered` | Default `true`: the items must match in order. `false`: the output is compared as a **multiset** — same items with the same multiplicities, in any order. Use it where order is unspecified (for example `std:merge` in `interleave` mode). |
| `tolerance` | Absolute numeric tolerance for comparing numbers (6.2). Default: exact. |
| `count` | The exact number of items on the port. |
| `schema` | A JSON Schema (2020-12) that **every item** must satisfy. This is the structural assertion for non-deterministic pipes — language models, sampling, timestamps — where exact text cannot be expected. |
| `disabled` | `true`: run with this optional output disconnected. No other assertion may accompany it. |
| `minLength`, `maxLength` | For a `text` output: bounds on the length of the whole output (all chunks concatenated), counted in Unicode code points. Non-negative integers. |
| `pattern` | For a `text` output: a regular expression (the portable subset of JSON Schema: no look-around, no back-references) that must match somewhere in the whole output; anchor it with `^` and `$` to match all of it. |

`count` and `schema` may be combined with `values` or `file`, or used
alone. For `binary` ports only `file` is meaningful. For `text` ports
`file` compares byte for byte, and the structural assertions
`minLength`, `maxLength` and `pattern` say something about text that cannot
be expected exactly — the answer of a language model, a rendered report.
They MAY be combined with each other and with `file`; on a port of any
other kind the test fails. A `pattern` that is not a valid regular
expression, or a negative length, is an error of the test file
(`E_MANIFEST`). A runner that does not implement them MUST fail the test
rather than ignore them.

**Outputs of runs that do not complete.** When the expected status is
`failed` or `cancelled`, how much output was produced before the failure
depends on buffering and timing and is not deterministic. Assertions on
such outputs SHOULD be limited to `schema` (everything that *was* emitted
is well-formed) and to `count: 0` where no output is possible at all; a
test runner evaluates whatever assertions are present against the output
actually received.

## 6. Comparison

### 6.1 Items

Items are compared as **JSON values**, not as text:

- objects are equal when they have the same member names with equal
  values; **member order is not significant** (and therefore cannot be
  asserted on item ports — it can on `text` ports, byte for byte);
- arrays are equal when they have equal elements in the same order;
- strings are compared by code point, with no Unicode normalisation;
- `true`, `false` and `null` equal only themselves;
- numbers: see 6.2.

### 6.2 Numbers

Without `tolerance`, two numbers are equal when they are **mathematically
equal as exact decimal values** — not after conversion to binary floating
point. `1`, `1.0` and `1e0` are equal;
`12345678901234567890123` and `12345678901234567890124` are not, and
neither are `0.1` and `0.1000000000000000055511151231257827`. A test
runner MUST therefore keep number literals (or exact decimals) from both
the expected and the actual side. This is what makes precision loss in a
runner or a pipe detectable.

With `tolerance: t`, numbers `a` and `b` are equal when `|a − b| ≤ t`. The
tolerance applies to every number in the compared items, at any depth. It
does not apply to `count`.

### 6.3 Unordered comparison

With `ordered: false`, the expected and actual item lists must be equal as
multisets under the equality above. With a `tolerance`, a runner matches
greedily in expected order; tests SHOULD avoid combining `ordered: false`
with a tolerance wide enough to make the matching ambiguous.

## 7. Results

For each test a test runner reports `passed`, `failed` (an assertion did
not hold; the report says which, with expected and actual values, subject
to the diagnostics rules below) or `error` (the test itself is unusable:
unknown port, missing required input, unreadable file). A runner MAY
additionally report `skipped` for a test whose target needs a capability
the runner does not have (`E_UNSUPPORTED` at validation), and MUST then
name the capability; skipped tests are not passes.

`openflange test` exits with status 0 only if no test failed or errored.
A test runner SHOULD apply a time limit per test and report a test that
exceeds it as failed.

## 8. Examples

Rejected records are data; the same input with the optional output
disconnected fails the run:

```yaml openflange:test
spec: openflange.org/test/v0.1
pipe: ./pipes/mask-email
tests:
  - name: masks the local part
    inputs:
      email: {values: ["alice@example.com", "ab@x.io", "ünïcödé@example.com"]}
    expect:
      outputs:
        email: {values: ["a***e@example.com", "**@x.io", "ü*****é@example.com"]}
        rejected: {count: 0}
  - name: routes an invalid address to rejected
    inputs:
      email: {values: ["not-an-address"]}
    expect:
      outputs:
        email: {values: []}
        rejected:
          count: 1
          schema:
            type: object
            required: [value, reason]
  - name: fails when rejected is not connected
    inputs:
      email: {values: ["not-an-address"]}
    expect:
      status: failed
      error: {code: E_RUNTIME}
      outputs:
        rejected: {disabled: true}
  - name: rejects an out-of-bounds parameter before running
    parameters: {preserveFirst: 9}
    inputs:
      email: {values: ["alice@example.com"]}
    expect:
      status: failed
      error: {code: E_PARAM}
```

Files, tolerance, unordered comparison and an optional input:

```yaml openflange:test
spec: openflange.org/test/v0.1
pipe: ./pipeline.yaml
tests:
  - name: summary within tolerance
    inputs:
      records: {file: data/values.ndjson}
      lookup: {disconnected: true}
    expect:
      outputs:
        summary:
          values: [{count: 3, mean: 20, median: 20, sd: 10}]
          tolerance: 1e-9
        audit:
          file: data/expected-audit.ndjson
          ordered: false
```

A structural assertion for a non-deterministic (model-backed) pipe, run
with an explicit grant:

```yaml openflange:test
spec: openflange.org/test/v0.1
tests:
  - name: classification has the right shape
    grants:
      subprocess: true
    inputs:
      feedback: {values: [{id: 1, text: "Great service"}]}
    expect:
      outputs:
        classified:
          count: 1
          schema:
            type: object
            required: [id, label, confidence]
            properties:
              label: {enum: [positive, negative, uncertain]}
              confidence: {type: number, minimum: 0, maximum: 1}
```

An output cannot be both disabled and asserted:

```yaml openflange:test invalid
spec: openflange.org/test/v0.1
tests:
  - name: contradictory
    expect:
      outputs:
        rejected: {disabled: true, count: 0}
```

## 9. Security considerations

Running a test **executes the target**. Everything in the security
sections of the Pipe, Pipeline and CLI specifications applies; a test file
is not a safer way to run untrusted code.

- **Permissions: enforce or refuse.** Tests run with exactly the grants
  they list. A test that needs a permission it does not list fails with
  `E_PERMISSION`; a test runner MUST NOT add grants implicitly.
- **Trusted mode honesty.** `trusted: true` grants everything the target
  declares, without sandboxing. A test runner MUST surface that a test
  requests trusted mode, and SHOULD refuse trusted tests unless the invoker
  opted in for that invocation. A **subprocess is not a sandbox**.
- **Untrusted test files.** Tests from a downloaded package are untrusted
  input: safe YAML (size limit, no aliases, no custom tags, duplicate keys
  rejected), schema validation, and **path-traversal** checks on every
  `file` reference before anything is opened.
- **Network.** Tests MUST NOT require paid or external services to pass.
  Pipes that call external providers are tested against local mocks; a test
  that needs network access says so in `grants`, and conformance fixtures
  never do. SSRF and redirect rules apply to any fetch a test causes.
- **Package lifecycle scripts** are not run to prepare a test.
- **Secret leakage.** Test files MUST NOT contain secrets. Failure reports
  include expected and actual data — test data only; a runner MUST NOT
  include environment values or secrets in reports.
- **Resource exhaustion.** Per-test time limits, the runner's ordinary
  stream bounds and a bound on collected output size apply; exceeding the
  output bound is a failed test, not a truncated comparison.

## 10. Compatibility and versioning

- The format is identified by `openflange.org/test/v0.1` in `spec`. A test
  runner MUST refuse a test file whose `spec` it does not support.
- Unknown keys are rejected, except `x-` extensions on the file and on
  tests, which a runner ignores if it does not understand them.
- New input forms and assertion keys are additions for a later minor
  version. While `experimental`, incompatible changes are possible with a
  `CHANGELOG.md` entry.
- Conformance fixtures are versioned with the specification repository; a
  fixture changes only together with the normative text it tests.

See `COMPATIBILITY.md` in the specification repository.

## 11. Deferred

Not part of v0.1: assertions on run reports (counters, `partialOutput`,
conversions) and on execution plans; prefix assertions for partial output;
timing and cancellation scenarios (a test that cancels mid-stream);
backpressure and bounded-memory assertions; secrets in tests; setup and
teardown steps; snapshot updating; a `requires` key for capability-gated
tests; tests of **reconnect**, **checkpointing**, **event-time
watermarks**, **session windows**, **distributed scheduling**, **WASM** and
**dynamic ports**, none of which exist in v0.1. Cancellation, backpressure,
HTTP and CLI protocol conformance are verified by implementation-level
tests until this format can express them.
