我正在尝试通过 Cucumber 最有效地利用 BDD。任何建议将不胜感激。
我有一个有很多层的应用程序。有许多用户,从基本管理员到完全所有者。每个角色都有不同的权限来查看其主页上的不同内容。我猜测试这个最有效的方法是使用表格?
基本用户的页面上应该只有一个部分,每个级别的用户都会增加这一点,直到最终一个完整的所有者可以在页面上拥有大约 20 个部分。我最初的想法是尝试一张桌子?
例如:
Feature: Home Page
As a user of the app
I want to see my homepage options
So I can interact with the correct applications
Background:
Given I have signed into my account
Scenario: User can view all their allowed apps
And my role is '<user>'
And I navigate to the homepage
When I click on the available apps opton
Then I should have '<apps>' available
Examples:
| user | apps |
...
接下来我是否只需在每个用户拥有的每个权限旁边写下他们?即使下一个级别获得与上一个级别相同的应用程序?
感觉重复次数令人难以置信。
例如:
...
Examples:
| user | apps |
| level_1 | app_1 |
| level_2 | app_1 |
| level_2 | app_2 |
| level_3 | app_1 |
...
在我到达 10 级之前,这就开始变得愚蠢了。
还有其他方法可以做到这一点吗?可能在步骤中吗?
您在步骤中使用了相对较低级别的操作。这不会让你从 Cucumber 中获得任何价值。
您可以编写具有更高抽象程度的特征文件。例如,用你自己的话来说:
Scenario:
Given there are many users from basic admins up to full owners.
And each role has different permissions to see different content on their home page.
When users open their page
The basic user should have just one section on their page
And this goes up with each level of user
And a full owner has possibility of about 20 sections on the page.