Skip to main content
StreamBuild discovers tests/**/*.sql, assembles each test as one ClickHouse query, and compares actual and expected rows with duplicate-aware bag semantics.

Model test

A model-mode test contains:
  1. TEST() with an optional name
  2. at least one source or model mock
  3. at least one expected target or zero-row assertion
  4. a ceremonial final SELECT 1

CTE roles

Arbitrary helper CTEs are allowed. A mock cuts dependency assembly at that relation; dependencies without a mock are assembled from the real compiled model graph. Multiple expected targets are executed in dependency order.

Zero-row assertion

Expected values

Expected CTEs may project only the columns under test. StreamBuild casts those values to the exact compiled target types before comparison. Comparison is bidirectional and NULL-safe:
  • duplicate multiplicity matters
  • missing and unexpected rows are both reported
  • NULL equals NULL through ClickHouse isNotDistinctFrom

Macro test

Use macro mode to test an otherwise standalone project macro:
Macro calls are allowed in __macro_actual__, not in macro expected or helper CTEs.

Multiple blocks

A file may contain multiple TEST blocks. Every block in a multi-test file must have a unique name. A single block may remain unnamed.

Run tests

Test selectors support bare model names, pipeline:<name>, and optional graph operators: Runtime SQL is written byte-for-byte under target/run/tests/. One warehouse execution error is reported as ERROR without preventing the remaining tests from running. Unsupported test surfaces include authored seeds, dbt refs, UDFs, table functions, and scenario mode.