dbt-unit-testing

Validate dbt transformation logic with unit tests using mocked inputs and expected outputs.

1|1|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/nrakow/ae-skills-dev --skill dbt-unit-testing
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dbt-unit-testing
Source: https://github.com/nrakow/ae-skills-dev/tree/main/skills/dbt-unit-testing
Command: npx skills add https://github.com/nrakow/ae-skills-dev --skill dbt-unit-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

dbt-unit-testing helps analytics engineers validate dbt transformations by writing unit tests that run without a warehouse connection, catching logic errors early with mocked inputs and expected outputs.

Core Features & Use Cases

  • Create unit tests in the model schema.yml using the unit_tests section to simulate inputs and verify outputs.
  • Use given blocks with mocked ref() and source() inputs, and optionally inline fixtures or CSV fixtures for larger datasets.
  • Support edge-case coverage, overrides for deterministic behavior, and macro compatibility to test compiled SQL rather than internals.

Quick Start

Provide a unit test by adding a unit_tests entry under the model's schema.yml, supply mocked inputs in given blocks, and assert expected outputs in the expect section.

Frequently Asked Questions about dbt-unit-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I unit test dbt models without a live warehouse connection?▼

Unit testing dbt models without a warehouse requires using the dbt core 1.8+ unit_tests YAML schema with mocked ref() and source() inputs to validate transformation logic deterministically.

How do I write a unit test for a dbt data model using YAML?▼

Writing a dbt unit test involves adding a unit_tests entry to your model's schema.yml, supplying mocked inputs in given blocks, and asserting expected outputs in the expect section.

Can I use CSV files to mock inputs for dbt unit tests?▼

CSV fixtures are supported for dbt unit tests to provide larger mocked datasets, alongside inline fixtures and overrides to achieve deterministic results across edge cases.

Does dbt unit testing require a specific version of dbt core?▼

Yes, dbt unit testing using the native unit_tests schema YAML structure requires dbt core version 1.8 or higher to execute given and expect fixtures.

What is the best way to test dbt SQL transformations for edge cases?▼

Testing dbt SQL edge cases is best handled by writing unit tests with mocked inputs and expected outputs, ensuring fast feedback and deterministic results without a live warehouse.

Why use dbt unit tests instead of standard data tests for logic validation?▼

dbt unit tests validate transformation logic using mocked inputs for fast feedback, whereas standard data tests typically validate assumptions against actual warehouse data.