# Unable to test the complex data models using new dbt testing framework

**URL:** <https://discourse.getdbt.com/t/unable-to-test-the-complex-data-models-using-new-dbt-testing-framework/13327>\
**Category:** In-Depth Discussions\
**Created:** [May 13, 2024, 1:55pm UTC](https://discourse.getdbt.com/t/unable-to-test-the-complex-data-models-using-new-dbt-testing-framework/13327 "2024-05-13T13:55:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankitkirar99](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@ankitkirar99](https://discourse.getdbt.com/u/ankitkirar99)\
**Post date:** [May 13, 2024, 1:55pm UTC](https://discourse.getdbt.com/t/unable-to-test-the-complex-data-models-using-new-dbt-testing-framework/13327/1 "2024-05-13T13:55:54Z")

</div>

Hi All,

> **[Unit tests | dbt Developer Hub](https://docs.getdbt.com/docs/build/unit-tests)**
>
> Learn how to use unit tests on your SQL models.

dbt introduce a new testing frame work (check the above link) we are also trying to implement same in our project. But this approach have issue like its working fine with simple models  
But in case of complex models this approach is throwing error because its not able to call the the source macro using schema.yml.  
We have one data model where we are perfoming union all with two regions data , so when Im doing testing testing just with one regions it working fine. Below i have provided the code for one union node.

SELECT \*  
FROM (  
SELECT \*  
FROM (

SELECT ID AS JSDHSJ, DSAHD AS ADHJA, SDBJSAD AS JHRJAHF, SDJK AS JDSFJ, SFJSA AS FDJFKL, AdhfM AS URD, AE AS CHAN, ZS, TIMSTP,SYS  
FROM (

SELECT ID AS JSDHSJ, DSAHD AS ADHJA, SDBJSAD AS JHRJAHF, SDJK AS JDSFJ, SFJSA AS FDJFKL, AdhfM AS URD, AE AS CHAN, ZS, TIMSTP,SYS  
FROM db.schema\_AS.ABC AS MAST

LEFT JOIN

(SELECT PREFIX,ZS  
FROM db.SAP.MAP) SYS

ON MAST.ZS = SYS.ZS))  
)

Similar we have another block of code only difference is that we taking the data from schema\_EU schema instead of schema\_AS and we club both the data set using union all. Its means when code size is get increases dbt fails to test the models.

**Error Message**  
Compilation Error in unit\_test logic\_testing\_0003 (models\virtualized\bom\_v\_make\_bom\_schema.yml)  
Unit\_Test ‘unit\_test.ops\_dbt\_wrk\_to\_wrk.v\_make\_bom\_\_my\_models’ (models\virtualized\make\_bill  
ofmaterials\_v\_make\_bom\_schema.yml) depends on a source named ‘Schema\_AS.MAST’ which was not found

**For your information we have verfied that Schema\_AS.MAST table is already avilable in source.yml.**  
Then also we are getting the above error.  
Pls help us on this issue.  
Thanks in advance
