Fitting tests into the development workflow
dbt testing verifies assumptions about your data and models throughout the development workflow, not just at the end. Tests should be run incrementally as you build models, and strategically before merging code or deploying to production to catch issues early.
1 · Learn the must-know
- Run
dbt buildinstead of separatedbt run+dbt testcommands to test each model immediately after it's created, stopping downstream dependents from running on failure by default. - Use
dbt test --select model_nameordbt build --select model_name+to test a specific model and its downstream dependencies during development. - Generic tests (unique,
not_null,accepted_values, relationships) are defined in YAML under a model'scolumns:ortests:key, while singular tests are standalone SQL files in thetests/directory. - Tests can be configured with
severity: warnversus the defaulterrorso that non-critical data quality issues surface without blocking the pipeline. - In CI/CD workflows, dbt tests typically run against a temporary schema built from modified code (often via Slim CI with
state:modified+) so only changed and downstream models are tested, saving compute. - The
--store-failuresconfig (orstore_failures: true) persists failing test records to a database table, making it easier to debug why a test failed without rerunning it.
2 · Check your understanding
Check this objectiveFree · always available
You add the following generic test to a model's schema.yml:
models:
- name: orders
columns:
- name: customer_id
tests:
- not_null:
config:
severity: warn
When you run dbt build and this test fails, what happens?
Your objective map0 tried · 0 answered correctly · 31 untouched
What you have tried across dbt Analytics Engineering's objectives, not a readiness score.
Developing and optimizing dbt models45.16% of the exam*0 of 14 tried
Managing dbt models governance9.68% of the exam*0 of 3 tried
Debugging data modeling errors16.13% of the exam*0 of 5 tried
Troubleshooting and optimizing dbt pipelines6.45% of the exam*0 of 2 tried
Implementing dbt tests9.68% of the exam*0 of 3 tried
Implementing and maintaining external dependencies6.45% of the exam*0 of 2 tried
Leveraging the dbt state6.45% of the exam*0 of 2 tried
* Our estimate. dbt Labs publishes no section weights.
3 · Keep going
Ready for more? Take a weighted mock or try free practice questions.