gpt4 book ai didi

java - Cucumber:场景大纲重用示例表

转载 作者:行者123 更新时间:2023-12-02 00:35:09 25 4
gpt4 key购买 nike

我有一些如下测试:

Scenario Outline: Add two numebrs
Given two numbers <number_1> and <number_2>
When I add them
Then Result is <number_3>

Examples:
|number_1|number_2|number_3|
|2 |3 |5 |
|1 |2 |3 |

Scenario Outline: Update two numebrs
Given two numbers <number_1> and <number_2>
When I update them
Then Result is <number_3>

Examples:
|number_1|number_2|number_3|
|2 |3 |5 |
|1 |2 |3 |

对于每个测试,我应该添加相同的表示例

有什么方法可以提取该表以便在所有测试中使用同一个表吗?

最佳答案

我想到的最简单的解决方案是将这两种情况结合起来,将详细信息提取到示例表中。所以它看起来像:

| number_1 | number_2 | operation | result |

你还有另一种可能性。

Scenario: Add two numebrs
Given I have the matrix of numbers
When I add them
Then I would have the resulting vector.

Scenario: Update two numebrs
Given I have the matrix of numbers
When I update them
Then I would have the resulting vector.

其中“数字矩阵”和“结果 vector ”转到步骤定义文件。

关于java - Cucumber:场景大纲重用示例表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26716186/

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