gpt4 book ai didi

php - 场景与场景大纲

转载 作者:可可西里 更新时间:2023-11-01 12:29:39 26 4
gpt4 key购买 nike

背景:

我目前正在为 Symfony2 网页编写行为测试 (Mink/Selenium)。我有很多例子可以引用,实际编写它们应该没问题。步骤定义已经写好了。

但是,在示例中,它们有时会定义一个Scenario:,有时会定义一个Scenario Outline:

问题:

这两种定义测试的方式有什么区别?

最佳答案

来自 the official guide :

Copying and pasting scenarios to use different values can quickly become tedious and repetitive:

Scenario: Eat 5 out of 12
Given there are 12 cucumbers
When I eat 5 cucumbers
Then I should have 7 cucumbers

Scenario: Eat 5 out of 20
Given there are 20 cucumbers
When I eat 5 cucumbers
Then I should have 15 cucumbers

Scenario Outlines allow us to more concisely express these examples through the use of a template with placeholders

Scenario Outline: Eating
Given there are <start> cucumbers
When I eat <eat> cucumbers
Then I should have <left> cucumbers

Examples:
| start | eat | left |
| 12 | 5 | 7 |
| 20 | 5 | 15 |

The Scenario Outline steps provide a template which is never directly run. A Scenario Outline is run once for each row in the Examples section beneath it (except for the first header row).

更多内容在 Writing Features指导。

关于php - 场景与场景大纲,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31067733/

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