Description
Following the suggestion from issue #296, I will try to re-implement pytest-bdd to use marks and hooks.
I imagine an API that will look like this:
# test_some_scenario.py
pytestmark = pytest.mark.scenarios('a.feature')
# override "Scenario 3"
@pytest.mark.scenario('a.feature', 'Scenario 3')
def test_a_scenario(...):
# do something more
pass
instead of the current way:
import pytest_bdd
# override "Scenario 3"
@pytest_bdd.scenario('a.feature', 'Scenario 3')
def test_a_scenario(...):
# do something more
pass
scenarios('a.feature')
I yet don't know if this is entirely feasible without breaking other features, but we will see.
Short note about @scenario(...)
Potentially, I will also remove the single scenario mark/decorator, given that the only thing it allows to do is to require some more fixtures before the scenario is run, and to execute some more logic after the scenario finished.
This custom logic can already be implemented using given
and then
steps, but I understand that sometimes it can be just some compensation logic that should not appear in the feature file.
I still didn't figure out what to do with this, so probably I'll keep the @scenario
mark/decorator for the time being.
@bubenkoff @olegpidsadnyi @sliwinski-milosz: Feedback on this idea would be appreciated.