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

adds description example of core logic for generic test #6944

Merged
merged 16 commits into from
Feb 28, 2025

Conversation

mirnawong1
Copy link
Contributor

@mirnawong1 mirnawong1 commented Feb 24, 2025

this pr tries to clarify how to add descriptions to the Jinja macro that provides the core logic of a generic data test.

updates done in the following pages:

  • data test configs
  • custom tests best practices
  • description property page
  • data test build page

Resolves #5631


🚀 Deployment available! Here are the direct links to the updated files:

@mirnawong1 mirnawong1 requested a review from a team as a code owner February 24, 2025 17:11
Copy link

vercel bot commented Feb 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview Feb 28, 2025 10:02am

@github-actions github-actions bot added content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: small This change will take 1 to 2 days to address labels Feb 24, 2025
Copy link
Contributor

@nataliefiann nataliefiann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hiya @mirnawong1

Thanks for creating this PR! I've approved this for you. No recommendations or suggestions from me.

Kind Regards
Natalie

Copy link
Contributor

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Note

If the name of the test block is not_empty_string, then the name of the macro to document has test_ added to the front: test_not_empty_string.

So documenting a macro named test_something would be applied to the test definition in tests/generic named something.

Example

For example tests/generic/not_empty_string.sql:

{% test not_empty_string(model, column_name) %}

select {{ column_name }}
from {{ model }}
where {{ column_name }} = ''

{% endtest %}
macros:
  - name: test_not_empty_string
    description: Complementary test to default `not_null` test as it checks that there is not an empty string. It only accepts columns of type string. It is deprecated as this functionality has been included in the custom implementation of `not_null`

@mirnawong1 mirnawong1 enabled auto-merge February 28, 2025 09:57
@mirnawong1 mirnawong1 merged commit df53c51 into current Feb 28, 2025
8 checks passed
@mirnawong1 mirnawong1 deleted the add-generic-test-macro branch February 28, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content Improvements or additions to content Docs team Authored by the Docs team @dbt Labs size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Core] How to add a description for custom generic tests
3 participants