I am getting the below error while running custom generic test.Can anyone help me out how to fix this error? 'test_Quantity_greater_than_10' is undefined. This can happen when calling a macro that does not exist. Check for typos and/or install package dependencies with "dbt deps".
{% test Quantity_greater_than_10(model,column_name) %}
with Product as (
select {{column_name}} as quantity
from {{model}}
)
select * from Product
where quantity>10
{% endtest %}
Where is your test stored? I tried copying your code and putting it in a file called test_Quantity_greater_than_10.sql in the macros directory and it worked correctly.
You can also put your generic tests (like this one) in the tests/generic directory, as described in the docs on writing custom generic tests.
If you have put this test inside of a different folder path then that could explain your problem.
Regardless, it’s worth noting that instead of making a custom test, you could instead use the dbt_utils.accepted_range test after adding the package to your packages.yml file: