pytest-dev / pytest-dev/pytest-bdd
How to customize auto-generated test name when using Scenario Outline?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 251
- Avg merge
- 43m
- Merged PRs (30d)
- 2
Description
First things first, thanks to everybody involved for creating such a useful module, I'm loving it. It took some time getting used to but now I feel like I'm flying.
Now the question: How to customize auto-generated test name when using Scenario Outline?
I have a test scenario where I'm using data
compare = [<, =, >]
name = [RISING, FALLING, NONE]
seconds= [0.0, 1.0]
that forms a Examples: table:
Examples:
| compare | seconds | name |
| < | 0 | NONE |
| < | 1 | NONE |
| = | 0 | NONE |
| = | 1 | NONE |
| > | 0 | NONE |
| > | 1 | NONE |
| = | 0 | RISING |
...
for this
@scenario('executed.feature', 'Scenario becoming true',
example_converters=dict(compare=str, seconds=float, name=str))
def test_scenario_never_becomes_true():
pass
and the output looks like

I've tried searching for pytest hook where I could get the test and generate a new name for it but didn't manage to find anything.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @scenario usage and executed.feature, then trace how the Scenario Outline Examples rows become pytest test names. Determine whether the project exposes a supported naming hook or configuration point. Done means a documented way to customize generated names, with coverage for the shown compare, seconds, and name values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100