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

No warning for duplicate Scenarios

Open jtpereyda opened this issue 9 years ago • 2 comments
trafficstars

If you create two valid scenarios with the same name, even with different steps, pytest will run the tests successfully with no warning or error. The only way to detect this is to count or list the tests and manually check that none is missing.

I'm guessing a warning would be best approach.

Are there any gotcha situations where allowing duplicates would actually be the best use case?

jtpereyda avatar Jul 18 '16 22:07 jtpereyda

Same for duplicate method names in the test file. If you have two different @given('...')s on a functions with the same name, no warning will be given.

This leads to hard-to-detect errors, since the user isn't looking at the function name so much as at the given/when/then string.

Instead of just raising a warning in this case, it would be nice to just treat these methods (that is, methods with the same name but different decorator contents) as different methods.

jtpereyda avatar Jul 19 '16 18:07 jtpereyda

Just ran into this and it was very frustrating to debug!

wren avatar Jan 15 '22 20:01 wren