在Gherkin语法中,“示例"和“方案"之间有什么区别? [英] In Gherkin syntax, what's the difference between Example and Scenario?

查看:70
本文介绍了在Gherkin语法中,“示例"和“方案"之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在其网站上: https://cucumber.io/docs/gherkin/reference/

它在关键字下列出了示例(或场景).有区别吗,还是可以用一个关键字完成所有工作,而用另一个关键字完成所有工作?

It lists Example (or Scenario) under keywords. Is there a difference, or can everything that can be done with one keyword, be done with the other?

推荐答案

场景是带有步骤的测试.方案大纲适用于您要循环使用表数据的方案,示例是该表的标题.

Scenario is a test with steps. Scenario Outline is for a scenario that you want to loop through with table data, Example is the heading of that table.

Scenario: Test something
  Given I am logged in
  And I select the "Add" tab
  And I select the "New" button
  Then the form is displyed

Scenario Outline: Test something else
  Given I am logged in as "<user>"
  And I select the "Add" tab
  And I select the "<item>" button
  Then the form is displyed
Examples:
    | user | item |
    | aaaa | Add  |
    | bbbb | Edit |

这篇关于在Gherkin语法中,“示例"和“方案"之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆