dbt includes testing out of the box:
Generic tests: Apply to any column.
models:
- name: orders
columns:
- name: order_id
data_tests:
- unique
- not_null
- name: status
data_tests:
- accepted_values:
values: ['pending', 'shipped', 'delivered']
Custom tests: Write SQL that returns failing rows.
-- tests/assert_positive_amounts.sql
SELECT * FROM {{ ref('orders') }}
WHERE amount < 0
If the query returns rows, the test fails. Simple and effective.