gpt4 book ai didi

naming - 更新SpecFlow方案大纲变体的名称

转载 作者:行者123 更新时间:2023-12-04 03:37:44 25 4
gpt4 key购买 nike

我有此功能文件:

Scenario Outline: Example
Given I am a user
When I enter <x> as an amount
Then the result should be <result>
Examples:
| x | result |
| 3 | 3 |
| 1 | 1 |

我的问题是运行后,每个示例都被标记为 variant #
有没有一种方法可以命名每个示例行实际测试的内容,以便在报告中我们可以更好地了解要测试的内容,而不仅仅是:
Scenario: Example, Variant 0
Scenario: Example, Variant 1
Scenario: Example, Variant 2

我正在努力帮助我们的测试人员获得更有意义的报告;通常,他们会写多个示例的原因是,他们希望以某种方式显示该示例的原因。

最佳答案

正如SpecFlow Scenario Outlines文档所说:

the Gherkin syntax does not enforce that all example columns have the matching placeholder in the scenario outline, you can even introduce an arbitrary column in the example sets for better test method name readability



因此,您可以在“示例”表中引入任意列,以简洁地描述测试的意图,例如
Scenario Outline: Example
Given I am a user
When I enter <x> as an amount
Then the result should be <result>
Examples:
| example description | x | result |
| Example Description 1 | 3 | 3 |
| Example Description 2 | 1 | 1 |

这将导致以下测试名称:
Example_ExampleDescription1
Example_ExampleDescription2

关于naming - 更新SpecFlow方案大纲变体的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21946550/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com