-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Support multiple test cases #56
base: main
Are you sure you want to change the base?
feat: Support multiple test cases #56
Conversation
@mjirv as requested, splitting the original into separate PRs |
@mjirv bumping for visibility |
@marcellovictorino thanks for bumping! I had missed that you updated this. Reviewing now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left one comment but overall this looks awesome!
The only other thing left is to add at least one integration test (https://github.com/mjirv/dbt-datamocktool/blob/main/integration_tests/models/staging/schema.yml). The steps would be:
- Copy/paste your example from the README into that schema.yml file (you can just use 1,2 as the test_cases)
- Add a seed/expectation for
ref('dmt__raw_customers_2')
andref('dmt__expected_stg_customers_2')
Would you like to add the integration test or do you want me to?
{% set individual_expected_output = adapter.get_relation(*full_path_list) %} | ||
|
||
{# Retrieve the SQL code with the input mapping applied, using mocked input #} | ||
{% set individual_test_sql = dbt_datamocktool.get_unit_test_sql(model, individual_input_mapping, depends_on, test_case) %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{% set individual_test_sql = dbt_datamocktool.get_unit_test_sql(model, individual_input_mapping, depends_on, test_case) %} | |
{% set individual_test_sql = dbt_datamocktool.get_unit_test_sql(model, individual_input_mapping, depends_on) %} |
I think you need to get rid of test_case
here, right? Or am I missing what it's supposed to be doing?
I get an error when running:
00:39:26 Encountered an error:
Compilation Error in test dbt_datamocktool_unit_test_stg_customers__ref_dmt__expected_stg_customers_____ref_dmt__raw_customers____1__2 (models/staging/schema.yml)
macro 'dbt_macro__get_unit_test_sql' takes not more than 3 argument(s)
> in macro test_unit_test (macros/dmt_unit_test.sql)
> called by macro get_unit_test_sql (macros/dmt_get_test_sql.sql)
> called by test dbt_datamocktool_unit_test_stg_customers__ref_dmt__expected_stg_customers_____ref_dmt__raw_customers____1__2 (models/staging/schema.yml)
@mjirv Thanks for the new review! |
@marcellovictorino awesome, let me know if you need anything! |
This is a:
Description & motivation
Addressing this issue, enables to define a test once, to be applied over multiple test cases.
Applicable when there are multiple test case scenarios, where the mocked input and expected output data (seed) represent a single case, having the seed file names identified by
test_case_1
,test_case_2
etc.Checklist
Additional comments
Splitting the original PR into two separate ones: this one focus on enabling multiple test cases within a single test definition