With the introduction of unit testing (coming to dbt-core in 1.8), we should create a new top level unit_tests: schema yml block.
Current spec as follows:
unit_tests:
- name: <test-name> # this is the unique name of the test
model: <model-name>
config:
meta: {dictionary}
tags: <string> | [<string>]
given:
- input: <ref_or_source_call> # optional for seeds
format: dict | csv
# if format csv, either define dictionary of rows or name of fixture
rows:
- {dictionary}
fixture: <fixture-name>
- input: ... # declare additional inputs
expect:
format: dict | csv
# if format csv, either define dictionary of rows or name of fixture
rows:
- {dictionary}
fixture: <fixture-name>
overrides: # optional: configuration for the dbt execution environment
macros:
is_incremental: true | false
dbt_utils.current_timestamp: str
# ... any other jinja function from https://docs.getdbt.com/reference/dbt-jinja-functions
# ... any other context property
vars: {dictionary}
env_vars: {dictionary}
- name: <test-name> ... # declare additional unit tests
With the introduction of unit testing (coming to
dbt-core
in1.8
), we should create a new top levelunit_tests:
schema yml block.Current spec as follows:
More examples here