# dbt tests

> Data tests built into open-source dbt Core: generic tests (unique, not_null, accepted_values, relationships), custom SQL tests, and unit tests that run with dbt test, extended by packages like dbt-utils and dbt-expectations.

Source: https://toolsfordata.com/tools/dbt-tests/ · Updated 2026-11-13

[Website](https://www.getdbt.com/) · [Docs](https://docs.getdbt.com/docs/build/data-tests) · [GitHub](https://github.com/dbt-labs/dbt) (14.1k stars)

Best for: dbt teams starting with data quality, since tests live next to the models and run in the same CI/CD.

## What it's used for

dbt tests are used to check data where dbt teams already work: tests live in the same YAML and SQL files as the models and run with dbt test or dbt build, so a failing test stops bad data before it reaches downstream models.

## Pricing

dbt tests are free in open-source dbt Core under Apache 2.0. The paid dbt platform runs the same tests on a schedule with a UI, but you don't need it to use them.

## Deployment

dbt tests run wherever dbt Core runs, locally, in CI or from an orchestrator, on your warehouse's compute.

## Review

Strengths:
- Free, and already there if you use dbt.
- Tests live next to the models and run in the same dbt build and CI.
- Packages such as dbt-utils and dbt-expectations add more generic tests.

Caveats:
- Only tests models and declared sources in your dbt project.
- No anomaly detection: thresholds are fixed values you set.
- In dbt Core, results stay in run logs and artifacts, with no dashboard or alerts.

Recommendation: Add Elementary OSS for anomaly detection and a report on top of dbt tests. For data diffs on pull requests, consider Recce; for contracts shared outside dbt, Data Contract CLI.

## Where it fits

- data testing (core): Data tests built into open-source dbt Core, where generic tests (unique, not_null, accepted_values, relationships) and custom SQL tests are SELECTs that return failing rows, plus unit tests on model logic, run with dbt test.
- open source (core): Data tests in open-source dbt Core under Apache 2.0, maintained by dbt Labs, with generic, custom SQL, and unit tests; the paid dbt platform adds hosted runs and a UI but tests work the same in Core.

## Alternatives

- [Elementary OSS](https://toolsfordata.com/tools/elementary-oss/): Consider Elementary OSS to add anomaly detection tests to the same dbt project, for free.
- [Soda Core](https://toolsfordata.com/tools/soda-core/): Consider Soda Core for checks outside dbt, in YAML, in any pipeline.
- [Great Expectations](https://toolsfordata.com/tools/great-expectations/): Consider Great Expectations for Python checks on files and DataFrames, not only dbt models.
- [Recce](https://toolsfordata.com/tools/recce/): Add Recce to see data diffs on every dbt pull request.
- [Data Contract CLI](https://toolsfordata.com/tools/data-contract-cli/): Consider Data Contract CLI to test ODCS contracts on Snowflake, Databricks, BigQuery and Kafka, for free.
- [Elementary Cloud](https://toolsfordata.com/tools/elementary-cloud/): The paid upgrade for dbt teams: monitoring, lineage and AI triage on top of your dbt tests.
