jeudi 13 octobre 2016

How do you determine step precedence in BDD

Consider these steps:

# Step A
@when(parsers.parse('I edit user {user} in {account}'))
@when('I edit user <user> in <account>')
def when_I_edit_user_in_account(user, account):

# Step B
@when(parsers.parse('I edit user {user}'))
@when('I edit user <user>')
def when_I_edit_user(user):

I am wondering how BDD determines which step to choose. In my step examples it always chooses step B even if my step is:

When I edit user Tom in Main Account

Does it always pick the shortest matching step? Is there a way to chance this? Are their any known design patterns to this problem?

Things I've tried:

  • Changing steps order in the code (Thinking maybe matches first one found)
  • Change the steps verbiage (works but not really a solution)

Are the steps wrong by design? Should I always force an account passed?

Notes: pytest-bdd http://ift.tt/2ekNkUH

Aucun commentaire:

Enregistrer un commentaire