Repository navigation
Step definitions not found when using centralized test_features.py with scenarios("features") #787
Replies: 1 comment
|
You can keep your separate step files. Add empty pytest_plugins = [
"tests.steps.user_login_steps",
"tests.steps.user_profile_steps",
"tests.steps.group_steps",
"tests.steps.common_steps",
]Keep A minimal reproduction raised |
Uh oh!
There was an error while loading. Please reload this page.
Hi pytest-bdd team,
I'm running into an issue with step definitions not being found when using a centralized test_features.py to include all feature files.
My project structure is as follows:
integration_test/
├─ pytest.ini
├─ conftest.py
└─ tests/
├─ test_features.py
├─ features/
│ ├─ user/
│ │ ├─ user_login.feature
│ │ └─ user_profile.feature
│ └─ group/
│ └─ create_group.feature
├─ steps/
│ ├─ user_login_steps.py
│ ├─ user_profile_steps.py
│ ├─ group_steps.py
│ └─ common_steps.py
└─ manager/
└─ user/
├─ test_add_user.py
└─ test_edit_user.py
In test_features.py I have
When I run pytest, I get:
step definition is not foundHowever, if I move the feature files into the same folder as their corresponding test file and prefix the test files with test_, everything works as expected.
My expectation is that using a centralized test_features.py with scenarios("features") should discover all steps automatically, since my test file starts with test_.
I'm using:
pytest-bdd>=7.0.0Could you clarify if this is the intended behavior, or if I'm missing something in the project structure or configuration?
Thanks in advance!
All reactions