← ClaudeAtlas

dbt-testinglisted

Use for any question or task about testing dbt models, including adding tests to a model's YAML and bad data such as duplicate IDs that a passing dbt build missed: generic, singular and custom-macro tests, model assertions, reading failures from run_results.json and gating dbt build on the results in CI.
testland/qa-skills · ★ 0 · Testing & QA · score 72
Install: claude install-skill testland/qa-skills
# dbt-testing ## Overview dbt distinguishes **data tests** (assertions on rows, e.g. unique / not_null) from **unit tests** (logic tests on transformations); this skill targets data tests. The YAML key was renamed from `tests:` to `data_tests:` to disambiguate; `tests:` remains a back-compat alias but you cannot have both on the same resource at the same time ([data-tests][1]). [1]: https://docs.getdbt.com/docs/build/data-tests ## When to use - The repo contains a `dbt_project.yml` or a `models/` directory with `.sql` files referencing `{{ ref(...) }}` / `{{ source(...) }}`. - The user asks about generic tests (`unique`, `not_null`, `accepted_values`, `relationships`) - the four built-in generics shipped with dbt ([data-tests][1]). - The user mentions dbt build failures, schema drift, or wants assertions on data flowing through models. - A CI workflow needs a quality gate that fails the pipeline when a model ships bad data. ## Authoring tests ### Generic tests in `schema.yml` Use `data_tests:` (canonical) - `tests:` is the legacy alias and cannot coexist with `data_tests:` on the same resource ([data-tests][1]). ```yaml version: 2 models: - name: orders columns: - name: order_id data_tests: - unique - not_null - name: status data_tests: - accepted_values: arguments: values: ['placed', 'shipped', 'completed', 'returned'] - name: customer_id data_tests: