如何处理行为中的常见步骤

时间:2020-01-07 04:58:23

标签: python-behave

我有4个功能文件,例如登录,添加到购物车,按产品搜索,运输方式计算。所有4个都是单独的功能文件,并且所有前4个步骤都完全相同,如下所示:

Given I go to website
When I click on the login button
Then I enter username and password
And I verify I am logged in successfully

如果我在所有功能文件中使用相同的步骤,则无法正常工作。它有一个模糊的步骤错误。

我的目标是首先登录所有4个功能文件,然后再进行下一步。

我面临的错误:

raise AmbiguousStep(message % (new_step, existing_step))
behave.step_registry.AmbiguousStep: @given('I am loggedin into website') has already been defined in
  existing step @given('I am loggedin into website') at features/steps/Steps_cart.py:5

0 个答案:

没有答案