Skip to main content

Tests

tip

On this page, <package> can be one of: web, mobile

The packages contains tests for both the scratch and derived models. Depending on your use case you might not want to run all tests in production, for example to save costs. There are several tags included in the packages to help select subsets of tests. Tags:

  • this_run: Any model with the _this_run suffix
  • scratch: Any model in the scratch sub directories.
  • derived: Any of the derived models i.e. page views, sessions and users.
  • primary-key: Any test on the primary keys of all models in this package.

For example if your derived tables are very large you may want to run the full test suite on the this_run tables, which act as the input for the derived tables, but only primary key schema tests on the derived tables to ensure no duplicates. If using such a set up, we would also recommend including the page/screen_view_in_session_value data test for the page/screen views derived tables. For Media Player tests depending on the selector chosen it will include the web tests as well as the bespoke media tests.

This is our recommended approach to testing and can be implemented using the selector flag (see YAML selectors section for more details) as follows:

dbt test --selector snowplow_<package>_lean_tests

This is equivalent to:

dbt test --select snowplow_<package>,tag:this_run # Full tests on _this_run models
dbt test --select snowplow_<package>,tag:manifest # Full tests on manifest models
dbt test --select snowplow_<package>,tag:primary-key,tag:derived # Primary key tests only on derived tables.
dbt test --select snowplow_<package>,tag:derived,test_type:data # Include the page/screen_view_in_session_value data test

Alternatively, if you wanted to run all available tests both in the Snowplow package, and your custom modules:

dbt test --selector snowplow_<package>
Was this page helpful?