adding-dbt-unit-test

Generate unit test YAML definitions mocking upstream inputs for dbt SQL models.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/shapris/svarus-darbas --skill adding-dbt-unit-test-shapris
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-dbt-unit-test
Source: https://github.com/shapris/svarus-darbas/tree/main/.kilocode/skills/dbt/skills/adding-dbt-unit-test
Command: npx skills add https://github.com/shapris/svarus-darbas --skill adding-dbt-unit-test-shapris

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Creates clear, repeatable unit tests for dbt SQL models so developers can validate model logic against controlled mock inputs and catch regressions before materializing tables.

Core Features & Use Cases

  • Model-Inputs-Outputs: Define a model, mock its upstream inputs, and assert expected output rows.
  • Multiple formats & fixtures: Support for dict, csv, and sql mock formats and external fixture files stored in test-paths.
  • Special cases & overrides: Handles incremental models, ephemeral dependencies, macro/vars/env_var overrides, and adapter-specific caveats for warehouses like BigQuery and Redshift.
  • Use Case: Add unit tests when implementing complex SQL transformations, fixing bugs, or practicing TDD to ensure deterministic behavior across versions and environments.

Quick Start

Create a unit test YAML entry that names the test, points to the target model, supplies given inputs for each ref/source dependency, and lists the expected output rows.

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 to mock upstream model inputs?

You write dbt unit tests by creating a YAML definition that names the test, points to the target model, supplies mock inputs for each dependency, and asserts the expected output rows.

What fixture formats can I use for dbt data testing?

You can supply mock inputs using dict, csv, and sql fixture formats, or reference external fixture files stored in the project's test-paths to validate expected model outputs.

Can I create unit tests for incremental dbt models and ephemeral dependencies?

Yes, you can create unit tests for incremental dbt models and validate ephemeral dependencies by generating YAML definitions that handle special cases to ensure deterministic behavior.

Does dbt unit testing support overriding macros, vars, and env_vars?

Yes, dbt unit testing supports overrides for macros, vars, and env_vars within your YAML definitions, allowing you to control mock inputs and validate expected outputs under specific configurations.

Are there warehouse-specific caveats when running dbt unit tests on BigQuery or Redshift?

Yes, there are warehouse-specific caveats when executing dbt unit tests on adapters like BigQuery and Redshift, which the generated YAML definitions document to ensure valid execution.

When should I use dbt unit tests instead of standard schema tests?

You should use dbt unit tests when implementing complex SQL transformations, fixing bugs, or practicing TDD to validate model logic against controlled mock inputs and catch regressions before materializing tables.