# singular test - question about ref and source .

**URL:** <https://discourse.getdbt.com/t/singular-test-question-about-ref-and-source/18107>\
**Category:** Help\
**Tags:** testing, dbt-core\
**Created:** [February 9, 2025, 12:36pm UTC](https://discourse.getdbt.com/t/singular-test-question-about-ref-and-source/18107 "2025-02-09T12:36:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![razlinky](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@razlinky](https://discourse.getdbt.com/u/razlinky)\
**Post date:** [February 9, 2025, 12:36pm UTC](https://discourse.getdbt.com/t/singular-test-question-about-ref-and-source/18107/1 "2025-02-09T12:36:50Z")

</div>

hi ,  
i developed a singular test as mentioned below :

{{ config(error\_if = ‘\>0’,severity = ‘error’) }}

select count(_) cnt  
from {{ ref(‘stg\_dim\_xxx’) }} a join {{source(‘main’,‘dim\_date’)}} dd  
on dd.date\_key between a.start\_date and a.\_end\_date  
where dd.date\_key between current\_date - 8 and current\_date - 1  
group by a.gw\_mid\_id, a.target\_mid\_id, dd.date\_key  
having count(_) \> 1

if the test failed so dbt keep running and run all the models .

after few checks I saw that the problem is with the left join to source dim date .

what is the best practice? do singular test must be only with refs and not sources ?
