dbt / Editorial solution guide

A dbt test invocation omits expected tests

Trace selection and test execution before accepting an apparently successful partial run.

About 3 min readContent reviewed

Read-only knowledge base · No public comments

Recognize the symptoms

A CI invocation finishes without the expected data tests, or reports a much smaller test count than the project owner intended. The command may otherwise appear successful.

Understand the likely causes

  • The selector, exclusion, resource type, project configuration or shell quoting can select a different set of nodes than expected. The test may also be absent, disabled or associated with a different resource.

Capture the invocation and project state

Record the exact command and quoted selector, dbt and adapter versions, target, project revision and sanitized output from the affected invocation. Identify the expected test by name and associated resource, then inspect the relevant manifest and run results from that same run. A result from an earlier revision is not a reliable selection record. Preserve the actual selected count and statuses rather than relying only on the command exit code.

Inspect the selected resource set

In an authorized disposable project with the same configuration, list the resources selected by the intended expression and compare them with the expected models and tests. Review graph operators, unions, intersections, exclusions and shell quoting using the syntax for the deployed dbt version. Selection and command resource-type filtering are separate steps. Confirm that the expected test exists, is enabled and belongs to the resource the selector actually reaches.

Correct and review the smallest selector

Adjust the selector or test configuration in source so the required test is included without unintentionally expanding the job to unrelated production work. Have the model owner review the intended set and run the changed selection against a disposable target. Avoid treating a larger test count as proof of correctness; compare exact test identities and their associated resources. Keep the original command and selected set for the incident record.

Verify the gate detects a controlled defect

Introduce a known invalid synthetic row in the disposable fixture and run the corrected test selection. Confirm that the expected test executes and reports the defect, then restore a valid fixture and verify its successful result. Inspect both individual test status and the CI gate’s treatment of failures or empty selections. A green run with no tests is not evidence that the data contract was exercised.

Verify the fix

Compare the final selected test identities and results with the reviewed requirement for the candidate revision. Confirm the controlled invalid fixture fails the intended gate and the valid fixture passes in the isolated target.

Keep it from recurring

  • Version selectors and test ownership with models, report selected and executed test counts, and exercise a known failure in CI validation. Recheck selection after project structure or dbt version changes.

Official references