dbt-labs / dbt-labs/dbt

[Feature] Ability to override how test names are generated

Open
#11,348 3 comments 3 reactions 0 assignees View on GitHub
engine:v1 status:triage type:feature
Dominant language
Rust
Stars
13.8k
Forks
2.6k
Avg merge
18h 51m
Merged PRs (30d)
63

Description

### Is this your first time submitting a feature request?

- [x] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)
- [x] I have searched the existing issues, and I could not find an existing issue for this feature
- [x] I am requesting a straightforward extension of existing dbt functionality, rather than a Big Idea better suited to a discussion

### Describe the feature

When testing models with a lot of tests (dozens), it becomes very difficult to target one single generic test (especially when the parameters change during development, which also changes the name of the test).

It would be good to be able to override how the test names are generated so that we can give them more static names. We already have `generate_database_name`, `generate_schema_name`, and `generate_alias_name` which we can use in order to override their respective counterpart.

All we would need is the ability to specify an override for test names with a macro named `generate_test_name`.

It would also allow us to give generic tests cleaner names than how they are currently generated.

### Describe alternatives you've considered

- Run all of the tests every single time, but this slows down the development cycle.
- We can hardcode a custom name for each test, but this adds a lot of overhead.

### Who will this benefit?

People who use a lot of generic tests.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing generate_database_name, generate_schema_name, and generate_alias_name macros and how generic tests construct their names. Confirm the supported override point and add coverage showing that generate_test_name can produce a stable custom name while existing naming behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Domain
data, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.