更新SpecFlow方案大纲变体的名称 [英] Updating the name of SpecFlow scenario outline variations
问题描述
我有此功能文件:
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 #
My issue is that after it's run, each example is labeled as variant #
有没有一种方法可以命名每个示例行实际测试的内容,以便在报告中我们可以更好地了解要测试的内容,而不仅仅是:
Is there a way to name what each example line is actually testing, so that in the report, we know better what is tested, not just:
Scenario: Example, Variant 0
Scenario: Example, Variant 1
Scenario: Example, Variant 2
我正在努力帮助我们的测试人员获得更有意义的报告;通常,他们会写多个示例的原因是,他们希望以某种方式显示该示例的原因.
I'm trying to help our testers get more meaningful reports; there is typically a reason they write multiple examples, and they want that reason for that example shown somehow.
推荐答案
As the SpecFlow Scenario Outlines documentation says:
Gherkin语法并不强制所有示例列都具有 方案大纲中匹配的占位符,您甚至可以 在示例集中引入任意列以进行更好的测试 方法名称的可读性
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
因此,您可以在示例"表中引入任意列,以简洁地描述测试的意图,例如
So you could introduce an arbitrary column into your "Examples" table to succinctly describe the intention of the test e.g.
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 |
这将导致以下测试名称:
This would result in the following test names:
Example_ExampleDescription1
Example_ExampleDescription2
这篇关于更新SpecFlow方案大纲变体的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!