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

Background steps stopped working after adding another Given - StepDefinitionNotFoundError

Open PeterAugustinak opened this issue 5 years ago • 2 comments

  1. put common steps out of feature step_def file for re-usability purposes
  2. run tests

Result: step definitions are not found. IDE (like Pycharm) has no problem to localize these steps. pytest-bdd can see common steps only in conftest.py. In case to place them to any other file with completely correct definitions (like common_steps.py), it is not working.

PeterAugustinak avatar Oct 29 '19 08:10 PeterAugustinak

you should import those steps in your conftest.py:

# conftest.py
from tests.common_steps import *

youtux avatar Oct 14 '20 12:10 youtux

you should import those steps in your conftest.py:

# conftest.py
from tests.common_steps import *

thanks a lot, very useful for me

xiaorong22 avatar Aug 22 '23 07:08 xiaorong22