Skip to content

Mentioned unit testing example on https://github.com/EqualExperts/dbt-unit-testing not working #187

@sushildjoshi

Description

@sushildjoshi

I am resuing below code to do unit testing on my models present in dbt.

I used this package - https://github.com/EqualExperts/dbt-unit-testing/

when I run below mentioned command I can see message " The selection criterion 'tag:unit-tests' does not match any nodes" in system logs and nothing happens.

please help me to figure out what going wrong here

code present in tests.sql inside folder tests/unit
code
command

{{
config(
tags=['unit-test','unit-tests']
)
}}

{% call dbt_unit_testing.test('customers', 'should show customer name') %}

{% call dbt_unit_testing.mock_ref ('stg_customers') %}
select null::Numeric as customer_id, 'John' as first_name, 'Doe' as last_name
{% endcall %}

{% call dbt_unit_testing.mock_ref ('stg_orders') %}
select null::numeric as customer_id, null::numeric as order_id, null as order_date where false
{% endcall %}

{% call dbt_unit_testing.mock_ref ('stg_payments') %}
select null::numeric as order_id, null::numeric as amount where false
{% endcall %}

{% call dbt_unit_testing.expect() %}
select null::Numeric as customer_id, 'John' as first_name, 'Doe' as last_name
{% endcall %}
{% endcall %}

command--

dbt test --select "tag:unit-tests"

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions