Skip to main content

Testing for dbts

dbt testing is how you check that models behave as expected. Generic tests such as unique, not_null, accepted_values and relationships are declared in YAML, singular tests are custom SQL queries that should return no rows, and descriptions in YAML feed the documentation site built with dbt docs.

Stage: Quality · Part of the dbt roadmap · Last reviewed 19 November 2026

What to learn in Testing

Testing interview questions

How does a dbt generic test work?

A generic test is a parameterised SQL query that selects rows violating a rule, and the test passes when it returns zero rows. You attach it to a column in YAML, and dbt compiles and runs the query against the built model.

What is the difference between dbt build and dbt run?

dbt run only executes models. dbt build runs models, tests, snapshots and seeds together in dependency order, and skips downstream models when an upstream test fails, which stops bad data propagating.

Where Testing fits in the dbt roadmap

Testing belongs to the Quality stage (intermediate level). Trust the data.

Back to the full dbt roadmap