Cucumber 如何处理太长的小黄瓜场景线?
我有一些场景的参数太多,大多数参数都会导致场景的变化。因此,我需要在场景名称中包含参数详细信息,以便深入了解场景。但是,这会导致场景行过长 例如:Cucumber 如何处理太长的小黄瓜场景线?,cucumber,gherkin,Cucumber,Gherkin,我有一些场景的参数太多,大多数参数都会导致场景的变化。因此,我需要在场景名称中包含参数详细信息,以便深入了解场景。但是,这会导致场景行过长 例如: Scenario: Create list for Today's unique stuff of 'X' item with multiple string attribute values and 'distinct count' aggregation Given I create a 'Create List' request and
Scenario: Create list for Today's unique stuff of 'X' item with multiple string attribute values and 'distinct count' aggregation
Given I create a 'Create List' request and name as 'New List'
When I add 'X' item to 'Create List' request
And I add item attribute to current list query on list preview request
| attribute | operator | values |
| id | EXMATCH | id1,id2 |
And I add list aggregation to current list query on 'Create List' request
| aggField | aggType |
| stuff | DISTINCT_COUNT |
And I send request to 'Create List' request date as 'TODAY'
Then 'success' parameter in response should be true
And received list name should be equal to created list name
And received list queries in 'Create List' response should be equal to created list queries
另一种情况:
Scenario: Create list for Today's unique stuff of 'X' item with multiple integer attribute values and 'sum' aggregation
或:
Scenario:为今天独特的“X”项创建列表,其中包含多个整型属性值、“sum”聚合和
根据影响场景的不同参数的数量,这可以持续下去。
我有一种感觉,必须有最佳实践来编写更清晰、更短的场景名称。有吗?
我应该如何处理这些长场景名称?或者,我可以找到更简单/更短的方式来表达场景的内容吗?Cucumber允许您使用自然语言(而不是编程语言)来编写场景。您可以使用自然语言的所有工具来简化场景 两个最强大的简化工具是
- 抽象
- 命名
- 这是什么样的清单
- 你为什么要创造它
- 人们会用这个列表做什么
- 为什么人们会觉得这个列表有用
- 命名您的功能
- 描述你的特征
- 为您的功能编写序言(功能和第一个场景之间的部分)
- 给你写剧本标题
- 这个参数会导致什么样的变化
- 为什么这种变化很重要?有自己的场景是否足够重要
Scenario: Create list for Today's unique stuff of 'X' item with multiple integer attribute values, 'sum' aggregation and <some other parameter related conditions which causes too long scenario name>