running tests on specific order

The problem I’m having

I created a test called “equal_sum_mart” which compares two tables and fails if the total sum of one particular column is not the same.
The tables are refreshed daily and one of the tables runs first and is updated first. This leads to having one table updated and the other later. So the test fails.

What I’ve already tried

Some solutions are:

  1. Specific in the main command “dbt build” the order of the tests
  2. Build a specific macro that runs the models

But there has to be a better solution to this. Any ideas ?

Thanks in advance :slight_smile: