Skip to content
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

[unit testing] create new top level "unit_tests:" #106

Closed
graciegoheen opened this issue Nov 28, 2023 · 0 comments · Fixed by #117
Closed

[unit testing] create new top level "unit_tests:" #106

graciegoheen opened this issue Nov 28, 2023 · 0 comments · Fixed by #117

Comments

@graciegoheen
Copy link

graciegoheen commented Nov 28, 2023

With the introduction of unit testing (coming to dbt-core in 1.8), we should create a new top level unit_tests: schema yml block.

Current spec as follows:

unit_tests:
  - name: <test-name> # this is the unique name of the test
    model: <model-name> 
    config: 
      meta: {dictionary}
      tags: <string> | [<string>]
    given:
      - input: <ref_or_source_call> # optional for seeds
        format: dict | csv
        # if format csv, either define dictionary of rows or name of fixture
        rows:
          - {dictionary}
        fixture: <fixture-name>
      - input: ... # declare additional inputs
    expect:
      format: dict | csv
      # if format csv, either define dictionary of rows or name of fixture
      rows: 
        - {dictionary}
      fixture: <fixture-name>
    overrides: # optional: configuration for the dbt execution environment
      macros:
        is_incremental: true | false
        dbt_utils.current_timestamp: str
	  # ... any other jinja function from https://docs.getdbt.com/reference/dbt-jinja-functions
          # ... any other context property
        vars: {dictionary}
        env_vars: {dictionary}
  - name: <test-name> ... # declare additional unit tests

More examples here

@joellabes joellabes linked a pull request Feb 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant