Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. dbt test --select

dbt · Testing & Documentation

dbt test --select

Easydbt-15
dbt testselectcligraph operators

Question

How does dbt test --select work, and how do you run tests for a subset of models?

Solution

dbt test --select ... runs only the tests that match the selection graph, instead of every test in the project.

Common patterns

# tests on one model
dbt test --select fct_orders

# tests on a model and its parents
dbt test --select +fct_orders

# tests tagged "smoke"
dbt test --select tag:smoke

# tests for everything under a path
dbt test --select path:models/marts

# one named singular test
dbt test --select assert_positive_order_amounts

Mental model

selection graph (models/sources/tags/paths)
        |
        v
only tests attached to / matching those nodes run

With dbt build --select fct_orders, you get the model and its tests in one DAG-aware invocation.

Why it matters

  • Fast local feedback while developing one mart
  • CI that tests only models changed in a PR (state selectors)
  • Avoid burning warehouse credits on unrelated suites

Interview tip: Mention graph operators (+, + suffix for children) and tags: "I select +model+ when I need upstream rebuilds and downstream validation together."

PreviousNext