我想对同一步骤的@ given,@ when和@then使用相同的方法。例如
Scenario: Launch an application
Given username and password entered
And login button pressed
Then the app launches
Scenario: Launch application again
Given user logged out
And username and password entered
When login button pressed
Then the app launches
Run Code Online (Sandbox Code Playgroud)
如果我在执行步骤中这样做:
@when('login button pressed')
@given('login button pressed')
def loginButtonPressed():
print 'button pressed'
Run Code Online (Sandbox Code Playgroud)
似乎pytest_bdd无法处理此问题。我得到错误:
没有找到“按下登录按钮”的固定装置,有没有办法为这些步骤取别名?