altimate-code icon indicating copy to clipboard operation
altimate-code copied to clipboard

feat: automated dbt unit test generation

Open anandgupta42 opened this issue 7 months ago • 0 comments

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.

anandgupta42 avatar Apr 10 '26 01:04 anandgupta42