Data test configurations
Related documentation
Data tests can be configured in a few different ways:
- Properties within .ymldefinition (generic tests only, see test properties for full syntax)
- A config()block within the test's SQL definition
- In dbt_project.yml
Data test configs are applied hierarchically, in the order of specificity outlined above. In the case of a singular test, the config() block within the SQL definition takes precedence over configs in the project file. In the case of a specific instance of a generic test, the test's .yml properties would take precedence over any values set in its generic SQL definition's config(), which in turn would take precedence over values set in dbt_project.yml.
Available configurations
Click the link on each configuration option to read more about what it can do.
Data test-specific configurations
Resource-specific configurations are applicable to only one dbt resource type rather than multiple resource types. You can define these settings in the project file (dbt_project.yml), a property file (models/properties.yml for models, similarly for other resources), or within the resource’s file using the {{ config() }} macro.
The following resource-specific configurations are only available to Data tests:
- Project file
- Config block
- Property file
version: 2
<resource_type>:
  - name: <resource_name>
    tests:
      - <test_name>: # # Actual name of the test. For example, dbt_utils.equality
          name: # Human friendly name for the test. For example, equality_fct_test_coverage
          <argument_name>: <argument_value>
          config:
            fail_calc: <string>
            limit: <integer>
            severity: error | warn
            error_if: <string>
            warn_if: <string>
            store_failures: true | false
            where: <string>
    columns:
      - name: <column_name>
        tests:
          - <test_name>:
              name: 
              <argument_name>: <argument_value>
              config:
                fail_calc: <string>
                limit: <integer>
                severity: error | warn
                error_if: <string>
                warn_if: <string>
                store_failures: true | false
                where: <string>
This configuration mechanism is supported for specific instances of generic tests only. To configure a specific singular test, you should use the config() macro in its SQL definition.