Skip to content

feat: automated dbt unit test generation #673

@anandgupta42

Description

@anandgupta42

Add a dbt_unit_test_gen tool and dbt-unit-tests skill that generates dbt unit tests from manifest + compiled SQL.

Problem

dbt unit testing (shipped v1.8) has near-zero adoption because writing test YAML is tedious — you must identify every upstream ref, mock each with correct column types, and manually compute expected outputs.

Solution

A tool that:

  • Parses manifest for model info, deps, columns, descriptions
  • Uses column lineage to understand input→output mappings
  • Detects testable SQL constructs (CASE/WHEN, JOINs, NULLs, division, aggregation, incremental)
  • Generates type-correct mock data with scenario coverage (happy path, null edge, boundary, incremental)
  • Assembles complete YAML via the yaml library
  • Returns rich semantic context (descriptions, lineage) for the LLM skill to refine values

Reuses existing infrastructure: parseManifest(), dbtLineage(), schema.inspect, sql.optimize, manifest caching.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions