MetricSign
EN|NLRequest Access
Medium severitydata quality

Power BI Refresh Error:
UnitTestFailure

What does this error mean?

A dbt unit test failed, indicating that the SQL transformation logic in a model did not produce the expected output for the defined static input fixtures. Unit tests validate model logic before data is processed, catching regressions before they reach production tables.

Common causes

  • 1The model's SQL logic was changed and no longer produces the expected output for the unit test fixtures
  • 2The unit test expected values were set up for an old business rule that has since been updated
  • 3A macro or variable used in the model resolves to a different value in the unit test context
  • 4The unit test fixtures contain an edge case (NULL, zero, empty string) that the model does not handle correctly
  • 5A ref() or source() dependency in the model was updated and changed the join or filter logic

How to fix it

  1. 1Run dbt test --select <model_name> --resource-type unit_test to see the expected vs. actual output.
  2. 2Review the unit test YAML to confirm the fixture inputs and expected outputs reflect the current business logic.
  3. 3If the logic change was intentional, update the expected values in the unit test YAML to match the new behavior.
  4. 4Add edge-case fixtures (NULL inputs, boundary values) to prevent regressions from similar data scenarios.
  5. 5Use dbt show --select <model_name> with the fixture inputs to debug the model output interactively.

Frequently asked questions

Are unit tests run as part of dbt build in dbt 1.8+?

Yes. In dbt 1.8+, dbt build and dbt test both execute unit tests alongside data tests. Use --resource-type unit_test or --resource-type test to run only one type.

Can I mock ref() and source() dependencies in unit tests?

Yes — this is the core feature of dbt unit testing. Define mock input data for each ref() or source() your model uses in the unit test YAML, and dbt will substitute the fixtures instead of querying the actual tables.

Other data quality errors