In pytest-BDD, it currently does not support the ability to use two different types / definitions of steps in a single function definition. Whatever the "work around"
Option 1: Turn off strict hardness mode
@pytest.fixture
def pytestbdd_strict_gherkin():
return False
:
@when('login button pressed')
def loginButtonPressed():
print 'button pressed'
Scenario: Use given anywhere
Given username and password entered
when login button pressed
then I am logged in
when login button pressed
: // ...
: ... .
.
2.
@given('login button pressed')
def loginButtonPressed():
print 'button pressed'
@when('login button pressed')
def when_loginButtonPressed():
loginButtonPressed()
@then('login button pressed')
def then_loginButtonPressed():
loginButtonPressed()
pros: , - > - > . ( 1 )
: , , ...