adding-dbt-unit-test

Define and run dbt model unit tests with YAML fixtures.

653|60|Updated Jan 8, 2026
One-click install
npx skills add https://github.com/dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test-dbt-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-dbt-unit-test
Source: https://github.com/dbt-labs/dbt-agent-skills/tree/main/skills/adding-dbt-unit-test
Command: npx skills add https://github.com/dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test-dbt-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Unit tests for dbt models help you verify that transformations produce expected results and prevent regression bugs as your project evolves. They enable test-driven development workflows by codifying input/output expectations.

Core Features & Use Cases

  • Create and run unit tests for dbt models using a YAML schema (unit_tests) and various input formats (dict, csv, sql) with fixtures.
  • Support for advanced scenarios including incremental, ephemeral, versioned models, and macro/variable overrides via overrides.
  • Guidance and references for examples, best practices, and caveats to ensure reliable test coverage.

Quick Start

Install the unit test skill in your project and start writing unit tests for your models using the unit_tests YAML schema.

Frequently Asked Questions about adding-dbt-unit-test

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

FAQPage Schema
How do I write dbt unit tests for my data models?

Run dbt unit tests by defining a unit_tests schema in YAML with the model name, given inputs as fixtures, and expected outputs to validate transformation logic and prevent regressions.

What input formats can I use for dbt unit test fixtures?

Dbt unit test fixtures can be defined using dict, csv, or sql input formats within the YAML schema, allowing flexible mocked inputs to validate model logic against expected outputs.

Can I unit test incremental and versioned dbt models?

Yes, you can unit test incremental and versioned dbt models. The testing schema supports versioning specifications and handles dependency-heavy projects to validate logic across different model states.

How do overrides work in dbt unit tests?

Overrides in dbt unit tests allow you to mock macros and variables, enabling controlled testing of dependency-heavy models by replacing external dependencies with expected static values.

Does dbt unit testing support test-driven development workflows?

Dbt unit testing supports test-driven development by codifying input and output expectations in YAML, allowing you to define expected transformation behavior before running models to prevent regression bugs.

What are the limitations of unit testing dbt models with fixtures?

Dbt unit testing requires a model name, given inputs, and expected outputs defined under the unit_tests YAML schema. Complex dependency-heavy models may need macro and variable overrides for accurate mocking.