tests/**/*.sql, assembles each test as one ClickHouse query, and compares
actual and expected rows with duplicate-aware bag semantics.
TEST() uses the same SQLBuild header grammar as MODEL(): write key value, not key: value.
Model test
TEST()with an optional name- at least one source or model mock
- at least one expected target or zero-row assertion
- 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.
StreamBuild stops traversing at each supplied mock and fills every unmocked path with the real
compiled model SQL. It evaluates assembled targets in dependency order, compares actual rows with
type-cast expected rows in both directions, and separately requires each assertion CTE to return no
rows. All of that work is emitted as one ClickHouse query for the test.
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_actual__, not in macro expected or helper CTEs.
Multiple blocks
A file may contain multipleTEST blocks. Every block in a multi-test file must have a unique
name. A single block may remain unnamed.
Run tests
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.
