【发布时间】:2017-03-14 09:28:37
【问题描述】:
我在我的项目中使用 BDD 的 codeception 驱动的小黄瓜。我想测试赋予角色的用户是否能够看到适合他的菜单入口点。
此时我使用这个场景:
Scenario: basic menu check
User "foo" has role "basic_user"
Given I am logged in as "foo" with password "Test123!"
Then I should see "Project" menu point
And I should see "Settings" menu point
And I should see "Notifications" menu point
And I should see "Messages" menu point
And I should see "Logout" menu point
Then I logout
我想多次重复使用 3 个步骤:
And I should see "Settings" menu point
And I should see "Notifications" menu point
And I should see "Messages" menu point
我不想每次创建新场景时都复制粘贴它。相反,我想把它写成......让我们说包含文件(也用小黄瓜语言),并在我的场景中使用它:
Scenario: basic menu check
...
Include "common_menu_check"
...
有可能吗?我该怎么做?
【问题讨论】:
标签: php bdd codeception gherkin