# Can I use dbt to generate a unit test query without running that unit test query ??

**URL:** <https://discourse.getdbt.com/t/can-i-use-dbt-to-generate-a-unit-test-query-without-running-that-unit-test-query/14884>\
**Category:** In-Depth Discussions\
**Tags:** testing\
**Created:** [August 15, 2024, 10:49am UTC](https://discourse.getdbt.com/t/can-i-use-dbt-to-generate-a-unit-test-query-without-running-that-unit-test-query/14884 "2024-08-15T10:49:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guido.vansteen](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/guido.vansteen/32/4393_2.png) [@Guido.vansteen](https://discourse.getdbt.com/u/Guido.vansteen)\
**Post date:** [August 15, 2024, 10:49am UTC](https://discourse.getdbt.com/t/can-i-use-dbt-to-generate-a-unit-test-query-without-running-that-unit-test-query/14884/1 "2024-08-15T10:49:51Z")

</div>

Hi, I am looking for an easy way to generate UNIT test queries, in the same way as dbt does when it is instructed to run a unit test.

When I instruct dbt to run a unit test, I see that in the background dbt generates a test query named test\_model\_name.sql in the folder: $dbt\_PROJECT\_DIR/target/compiled/my\_project/models/enriched/model\_name.yml/models/enriched/. Obviously, when dbt is asked to run a unit test, it runs the query test\_model\_name.sql immediately after it is generated. The latter is what I would like to avoid.

So, is there an easy way (preferably from the command line) to instruct dbt to create a test query like $dbt\_PROJECT\_DIR/target/compiled/my\_project/models/enriched/model\_name.yml/models/enriched/test\_model\_name.sql without actually running it?
