Erw*_*ers 1 bdd cucumber specflow gherkin
我们正在为我们的应用程序创建 Gherkin 功能文件,以创建可执行规范。目前我们的文件如下所示:
Given product <type> is found
When the product is clicked
Then detailed information on the product appears
And the field text has a value
And the field price has a value
And the field buy is available
Run Code Online (Sandbox Code Playgroud)
and我们想知道验证字段在屏幕上是否可见的整个关键字列表是否是正确的方法,或者我们是否应该将其缩短为“验证输入”之类的内容。
我们有一个类似的案例,我们的服务可以为我们可以验证的每个案例返回大量 10 个元素。我们不会验证每次交互的每个元素,我们只测试与测试用例相关的元素。
为了更容易维护和切换我们正在使用的元素,我们使用场景大纲和示例表。
Scenario Outline: PO Boxes correctly located
When we search in the USA for "<Input>"
Then the address contains
| Label | Text |
| PO Box | <PoBox> |
| City name | <CityName> |
| State code | <StateCode> |
| ZIP Code | <ZipCode> |
| +4 code | <ZipPlus4> |
Examples:
| ID | Input | PoBox | CityName | StateCode | ZipCode |
| 01 | PO Box 123, 12345 | PO Box 123 | Boston | MA | 12345 |
| 02 | PO Box 321, Whitefish | PO Box 123 | Whitefish | MN | 54321 |
Run Code Online (Sandbox Code Playgroud)
通过这种方式,我们有一个通用步骤“地址包含”,它使用“标签”和“文本”来测试各个元素。这是一种测试许多潜在组合的简洁方法 - 但这可能取决于您的个人用例 - 所有字段的重要性。
| 归档时间: |
|
| 查看次数: |
1624 次 |
| 最近记录: |