可能出现以下情况吗?我正在使用葫芦机器人进行测试。
我有 3 种类型的用户
我想登录 3 个元素中的每一个,并确保屏幕包含 9 个元素中的每一个。
然后让每个用户类型查找 9 种元素中的每一个吗?
Feature: Overview screen on Mobile App
In order to access all the features of the Mobile App
As a user of the Mobile App
I want to be able to access the features through the Overview Screen
@high
Scenario Outline: Overview Screen Appearance
Given I login to an <type> account
Examples:
| type |
| secure |
| user |
| admin |
Then I should see the <element>
Examples:
| element |
| Overview Header |
| Status Icon |
| Status Text |
| Status Time |
| Current Temp Icon |
| Navigation Overview Text |
| Navigation Overview Icon |
| Navigation Activity Text |
| Navigation Activity Icon |
谢谢
这听起来更像是使用数据表的任务。然后,实现该步骤的代码将检查 datatable 参数的每个元素是否存在于页面上。
Scenario Outline: Overview Screen Appearance
Given I login to an <type> account
Then I should see the following elements:
| element |
| Overview Header |
| Status Icon |
| Status Text |
| Status Time |
| Current Temp Icon |
| Navigation Overview Text |
| Navigation Overview Icon |
| Navigation Activity Text |
| Navigation Activity Icon |
Examples:
| type |
| secure |
| user |
| admin |
您也可以考虑使用 FactoryGirl。
如果你有复杂的数据模型,你可以简单地以工厂的形式将其抽象出来,而不是制作复杂的静态特征文件。