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

[CT-3323] Allow singular tests to be documented #9005

Closed
gshank opened this issue Nov 6, 2023 · 3 comments · Fixed by #10744
Closed

[CT-3323] Allow singular tests to be documented #9005

gshank opened this issue Nov 6, 2023 · 3 comments · Fixed by #10744
Assignees
Labels
dbt tests Issues related to built-in dbt testing functionality enhancement New feature or request Impact: CA Impact: Exp paper_cut A small change that impacts lots of users in their day-to-day user docs [docs.getdbt.com] Needs better documentation
Milestone

Comments

@gshank
Copy link
Contributor

gshank commented Nov 6, 2023

Description

Currently, you can document pretty much everything but a data test - if you try, it fails on a parsing error. This ticket is for singular tests. A separate ticket (#2578) addresses generic tests.

Currently we don't have a "tests" section in schema files. In order to allow setting descriptions in yaml files we should add one. (As a side issue, the SingularTestNodes use the TestConfig, which is not particularly valid for SingularTestNodes. Maybe we need a separate SingularTestConfig.)

https://docs.getdbt.com/docs/build/tests#singular-tests

Acceptance Criteria

  • You can add a description to a singular test in a yaml file
  • You can use a docs block to capture your test description
  • That description shows up in the docs site

Considerations

  • Do we need to exclude this from state modified?
  • New section in schema files and new schema parser
  • Don't have a test schema parser
  • Need yml to be able to have a description
@github-actions github-actions bot changed the title Allow singular tests to be documented [CT-3323] Allow singular tests to be documented Nov 6, 2023
@MichelleArk
Copy link
Contributor

MichelleArk commented Nov 29, 2023

Since singular tests aren't explicitly linked to models in schema.yml files already, we would need to introduce a new top-level 'tests' resource in order to parse descriptions:

# top-level
tests:
  - name: my_super_cool_singular_test
    description: The order_id is unique for every row in the orders model
    config:
      error_if: ">10"
  - name: my_super_cool_singular_test2
    description: '{{ doc("not_null_test") }}'

cc @graciegoheen @jtcohen6

@graciegoheen
Copy link
Contributor

Yep - this feels similar to how we handle descriptions for seeds or macros! Only adjustment I would say is data_tests: instead of tests: (since we're introducing unit tests in 1.8):

# top-level
data_tests:
  - name: my_super_cool_singular_test
    description: The order_id is unique for every row in the orders model
    config:
      error_if: ">10"
  - name: my_super_cool_singular_test2
    description: '{{ doc("not_null_test") }}'

@graciegoheen graciegoheen added the dbt tests Issues related to built-in dbt testing functionality label May 29, 2024
@graciegoheen graciegoheen added this to the v1.9 milestone May 29, 2024
@dbeatty10 dbeatty10 added paper_cut A small change that impacts lots of users in their day-to-day Impact: Exp enhancement New feature or request labels Jun 9, 2024
@aranke aranke self-assigned this Sep 18, 2024
@aranke aranke closed this as completed in 3ac20ce Sep 24, 2024
@graciegoheen graciegoheen added the user docs [docs.getdbt.com] Needs better documentation label Sep 24, 2024
@FishtownBuildBot
Copy link
Collaborator

Opened a new issue in dbt-labs/docs.getdbt.com: dbt-labs/docs.getdbt.com#6132

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dbt tests Issues related to built-in dbt testing functionality enhancement New feature or request Impact: CA Impact: Exp paper_cut A small change that impacts lots of users in their day-to-day user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants