Custom Tests
Learn how to extend dbt™'s testing capabilities with custom tests. This guide covers creating singular and generic tests, implementing parameterized tests, and integrating with dbt packages for ad
Types of Custom Tests
Test Type
Description
Where Defined
Scope
Singular Tests
-- tests/assert_total_payment_amount_matches_order_amount.sql
SELECT
order_id,
order_amount,
payment_amount,
ABS(order_amount - payment_amount) as amount_diff
FROM {{ ref('orders') }} o
LEFT JOIN {{ ref('payments') }} p USING (order_id)
WHERE ABS(order_amount - payment_amount) > 0.01Creating Generic Custom Tests
Combining Macros and Tests
Advanced Test Configurations
Configuration
Description
Example Use Case
Testing Data Quality with Packages
Package
Purpose
Key Features
Real-World Custom Test Examples
Best Practices for Custom Tests
Best Practice
Description
Last updated
Was this helpful?