为 SpecFlow 场景大纲拆分 Given 和 Then 中的示例

Splitting examples in Given and Then for SpecFlow Scenario Outline

我正在编写一个具有多个输入和输出参数(每个大约 4-5 个)的 specflow 场景。使用场景大纲时,我需要写一个宽 table 在同一行中同时给出输入和输出列。有什么办法可以为步骤定义单独指定示例吗?这是为了提高可读性。

当前状态

Given - State of the data
When I trigger action with parameters <input1> and <input2> and ...
Then my output should contain <output1> and <output2> ...

Examples:
| input1 | input2 |... | output1 | output2 |...

我可以这样做吗?

Given - State of the data
When I trigger action with parameters <input1> and <input2> and ...
       Examples of input
Then my output should contain <output1> and <output2> ...
        Examples of output

不,不幸的是(或任何类似的)是不可能的。 您可以使输入和输出更加抽象,并可能合并几列。示例:而不是国家 |邮政编码 |城市 |街道 |房子 |名字 |姓 |等你应该有|地址 |职称 |地址的值为 "EU"、"US, missing postal code"、"HQ"。

场景大纲不能有多个示例 table,但可以为常规场景传入数据 table。

数据 table 只能由使用它的步骤访问,但是您可以将其保存在场景上下文中以供后续步骤使用。

如果您的场景很复杂并且跨越多行,我不确定这是否适合您,但我想我会提到它。

Scenario: Checking outputs for inputs
Given - State of the data
When I trigger action with the following parameters  
input1 | input2 | input3 |
data   | data   | data   |

Then my output should contain the following outputs
output1 | output2  | output3 |
data    | data     | data    |