# Compilation error While running Custom Generic Test

**URL:** <https://discourse.getdbt.com/t/compilation-error-while-running-custom-generic-test/8373>\
**Category:** Help\
**Tags:** testing\
**Created:** [May 20, 2023, 7:23pm UTC](https://discourse.getdbt.com/t/compilation-error-while-running-custom-generic-test/8373 "2023-05-20T19:23:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![saadqureshi45](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/saadqureshi45/32/2440_2.png) [@saadqureshi45](https://discourse.getdbt.com/u/saadqureshi45)\
**Post date:** [May 20, 2023, 7:23pm UTC](https://discourse.getdbt.com/t/compilation-error-while-running-custom-generic-test/8373/1 "2023-05-20T19:23:46Z")

</div>

Hi,

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".`

```yaml
version: 2
models:
  - name: STG_PRODUCT
    columns:
      - name: quantity
        tests:
          - Quantity_greater_than_10

```

```sql
{% 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 %}

```

---

<div class="post-metadata">

**Author:** ![a\_slack\_user](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/a_slack_user/32/1629_2.png) [@a\_slack\_user](https://discourse.getdbt.com/u/a_slack_user)\
**Post date:** [May 21, 2023, 12:54pm UTC](https://discourse.getdbt.com/t/compilation-error-while-running-custom-generic-test/8373/2 "2023-05-21T12:54:51Z")

</div>

your test name is ‘Quantity\_greater\_than\_10’. in the error test name mentioned is ‘test\_Quantity\_greater\_than\_10’

check the name

Note: `@Arun` originally [posted this reply in Slack](https://getdbt.slack.com/archives/CBSQTAPLG/p1684673683895619?thread_ts=1684610647.441299&cid=CBSQTAPLG). It might not have transferred perfectly.

---

<div class="post-metadata">

**Author:** ![Surya](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/surya/32/3763_2.png) [@Surya](https://discourse.getdbt.com/u/Surya)\
**Post date:** [May 22, 2023, 4:49am UTC](https://discourse.getdbt.com/t/compilation-error-while-running-custom-generic-test/8373/3 "2023-05-22T04:49:17Z")

</div>

can you pls post your yml fie here where you have configured tests

---

<div class="post-metadata">

**Author:** ![joellabes](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/joellabes/32/3980_2.png) [@joellabes](https://discourse.getdbt.com/u/joellabes)\
**Post date:** [June 15, 2023, 5:01am UTC](https://discourse.getdbt.com/t/compilation-error-while-running-custom-generic-test/8373/4 "2023-06-15T05:01:48Z")

</div>

Hey @saadqureshi45,

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](https://docs.getdbt.com/guides/best-practices/writing-custom-generic-tests#generic-tests-with-standard-arguments).

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](https://github.com/dbt-labs/dbt-utils#accepted_range-source) test after adding the package to your `packages.yml` file:

```yaml
version: 2
models:
  - name: STG_PRODUCT
    columns:
      - name: quantity
        tests:
          - dbt_utils.accepted_range:
              min_value: 10

```
