On this page
Developers Command-line workflows
Test a shared model
List a model's tests, run them on the warehouse, read what failed, and keep the new rows after a change that you meant to make.
A test is a fixed question with a fixed answer: these fields, over these dates, return exactly these rows. Run a model’s tests after you change it, or after new data loads, so that no number moves by surprise. This page tests the shared model semantic.ad_reporting.
The commands and their times are real. Long waits are shortened in the recording.
-
List the tests.
kater test listshows each test of the model, its kind, and how it last ran. It runs nothing.Terminal window kater test list --model semantic.ad_reportingsemantic.ad_reporting: 12 tests, last run 2026-10-165 passing, 7 failing, 0 drafts, 0 never run, 7 stale2 refused, 7 rows, 3 same_asfailed clicks_impressions_by_platform rows (stale) added by Ana Lopez, 2026-10-16passed spend_needs_currency refused added by Ana Lopez, 2026-10-16failed july_2026_totals_by_platform rows (stale) added by Ana Lopez, 2026-10-16passed matches_dbt_ad_report_mart same_as added by Ana Lopez, 2026-10-16...A
rowstest expects exact rows. Asame_astest expects the same answer as another query, such as a dbt mart. Arefusedtest expects the compiler to refuse its SQL, such as a total of spend across currencies. “stale” says that the test’s SQL moved since its last pass. -
Check without the warehouse first.
--compile-onlycompiles every test and runs nothing on the warehouse. It says which tests your change moved.Terminal window kater test --select semantic.ad_reporting --compile-only -
Run the tests.
Terminal window kater test --select semantic.ad_reportingEach failed test ends the run with a block: its name, its file, and what differs.
15:02:10 Failure in test july_2026_totals_by_platform (connections/snowflake_prod_connection/modeling/kater_objects/tests/ad_reporting.sql)15:02:10 Got 6 values that differ from what the test expects.15:02:10 sql: 6 rows expected or returned on one side only.15:02:1015:02:10 Done. PASS=5 WARN=0 ERROR=7 SKIP=0 TOTAL=12Add
--show-sqlto print the Kater SQL and the warehouse SQL that each test ran. -
Keep the new rows after a change that you meant to make.
When the numbers moved because you changed the model on purpose,
--updaterecords the new rows of each failingrowstest and prints each number that moved. It never changes asame_asor arefusedtest. Read the numbers before you commit them.Terminal window kater test --select semantic.ad_reporting --updategit diff -
Add a test.
Write the question as Kater SQL in a file, and let
--recordrun it one time and keep the rows that it returns.Terminal window kater new test july_2026_spend_by_platform --model semantic.ad_reporting --sql-file totals.sql --recordThe test goes in your own test file. Add
--sharedto put it in the shared layer’s test file, which everyone reads. -
Check that the model is ready to hand off.
Terminal window kater test readiness --model semantic.ad_reporting
kater test list --model MODELshows no test as “never run”.kater test --select MODELends withERROR=0.- Each number that
--updatemoved is one that your change was meant to move.
If something looks wrong
| You see | What to do |
|---|---|
Got N values that differ from what the test expects. and the test’s SQL did not change | The data changed. Check the source before you run --update. |
The picker path does not compile | The test’s field picker selections are not valid on the model now, for example after a field was renamed. The message names the field. Change the test. |
| The run stops and names more than one connection | A run reads the tests of one connection. Add connection:NAME to the selection, such as --select connection:snowflake_prod_connection,tag:team=marketing. |
A test is WARN with no answer yet | It is a same_as test with no native SQL, or a draft. Give it its other query, or run it one time with --record. |
Next steps
- Tests, for what a test holds and where tests live
kater test, with the merge check--select state:modified+ --state git:main --stalefor CI- Change a query and build it