From df867a7ed14bf10fc7ce60413fc90be7b9c43a84 Mon Sep 17 00:00:00 2001 From: Drew Banin Date: Mon, 14 May 2018 15:59:02 -0400 Subject: [PATCH] Update README.md --- integration_tests/README.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/integration_tests/README.md b/integration_tests/README.md index 9bfb251fe00..894188d4302 100644 --- a/integration_tests/README.md +++ b/integration_tests/README.md @@ -1,10 +1,20 @@ ### dbt integration test suite for dbt-utils -database support: - - [x] postgres - - [x] redshift - - [ ] bigquery (partial) - - [ ] snowflake (partial) - -todo: - - [ ] run in CI for at least postgres +This directory contains an example dbt project which tests the macros in the `dbt-utils` package. An integration test typically involves making 1) a new seed file 2) a new model file 3) a schema test. + +For an example integration tests, check out the tests for the `get_url_parameter` macro: + +1. [Macro definition](https://github.com/fishtown-analytics/dbt-utils/blob/master/macros/web/get_url_parameter.sql) +2. [Seed file with fake data](https://github.com/fishtown-analytics/dbt-utils/blob/master/integration_tests/data/web/data_urls.csv) +3. [Model to test the macro](https://github.com/fishtown-analytics/dbt-utils/blob/master/integration_tests/models/web/test_urls.sql) +4. [A schema test to assert the macro works as expected](https://github.com/fishtown-analytics/dbt-utils/blob/master/integration_tests/models/web/schema.yml#L2) + + +Once you've added all of these files, you should be able to run: +``` +$ dbt seed +$ dbt run --model {your_model_name} +$ dbt test --model {your_model_name} +``` + +If the tests all pass, then you're good to go! All tests will be run automatically when you create a PR against this repo.