pytest-bdd icon indicating copy to clipboard operation
pytest-bdd copied to clipboard

How to customize auto-generated test name when using Scenario Outline?

Open ThrashAbaddon opened this issue 5 years ago • 0 comments
trafficstars

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 image

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.

ThrashAbaddon avatar Apr 08 '20 19:04 ThrashAbaddon