我在应用程序中有一个表单,需要填充数据,比如创建一个雇员。需要填写详细信息,如员工代码、姓名、地址、银行详细信息。我创建了一个包含4个场景的功能文件:
details
当字段相同时,如何传递5-10名员工的数据?问题是在创建时需要填充15-20个字段。我尝试使用示例关键字,行长度增加,这使得滚动和搜索变得困难。我还有别的方法可以给他们投入吗?我怀疑我们能否为每个场景提供4个示例文件。这是真的吗?
请帮忙找个更好的办法。
下面是一个屏幕截图,展示了我刚才提到的示例文本:

发布于 2021-01-13 14:50:35
不要将所有字段都包含在示例表中,而是关注与当前场景相关的字段。
例如,有关个人详细信息的场景如下所示:
Scenario Outline: Entering personal details when creating an employee
Given the user is creating a new employee
When the user enters the employee personal details:
| Field | Value |
| First Name | <First Name> |
| Last Name | <Last Name> |
| Date of Birth | <Date of Birth> |
And the user enters the employee address
And the user enters the employee banking details
And the user saves the new employee
Then ...
Examples:
| First Name | Last Name | Date of Birth |
| ... | ... | ... |
| ... | ... | ... |
| ... | ... | ... |步骤When the user enters the employee personal details:包含与输入个人详细信息相关的字段。有关输入员工地址和银行详细信息的其他步骤可以使用通用数据,只要输入的数据满足业务规则。
同样,想象一下输入地址的场景:
Scenario Outline: Entering new employee address
Given the user is creating a new employee
When the user enters the personal details for the new employee
And the user enters the employee address:
| Field | Value |
| Line 1 | <Line 1> |
| Line 2 | <Line 2> |
| City | <City> |
| State | <State> |
| Postal Code | <Postal Code> |
And the user enters the employee banking details
And the user saves the new employee
Then ...
Examples:
| Line 1 | Line 2 | City | State | Postal Code |
| ... | ... | ... | ... | ... |
| ... | ... | ... | ... | ... |
| ... | ... | ... | ... | ... |这使得每个场景的示例表都更小,更易于阅读,但也为您提供了大量的数据输入灵活性。
https://stackoverflow.com/questions/65674703
复制相似问题