Mentioned unit testing example on https://github.com/EqualExperts/dbt-unit-testing not working
sushildjoshi opened this issue · 3 comments
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
{{
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"
@sushildjoshi Try removing the quotes around 'tag:unit-tests': dbt test --select tag:unit-tests
Hi @sushildjoshi , did you manage to solve your issue with @martanthony suggestion?
@sushildjoshi I guess this is quite late for you, but maybe useful for anyone in the future looking at this again.
I was having the same issue and realised that there was a typo in the name I had given to the model inside the call statement
{% call dbt_unit_testing.test('dummy', 'testing that I can get unit-test to work') %}
In your case, I don't see the customers
model in the tree of files, so maybe it was that