引用链接:https://github.com/cucumber/cucumber/wiki/Scenario-Outlines

    1. script/cucumber --i18n zh-CN
    2. | feature          | "功能"       |
    3. | background       | "背景"       |
    4. | scenario         | "场景"       |
    5. | scenario_outline | "场景大纲"     |
    6. | examples         | "例子"       |
    7. | given            | "* ", "假如" |
    8. | when             | "* ", "当"  |
    9. | then             | "* ", "那么" |
    10. | and              | "* ", "而且" |
    11. | but              | "* ", "但是" |
    12. | given (code)     | "假如"       |
    13. | when (code)      | "当"        |
    14. | then (code)      | "那么"       |
    15. | and (code)       | "而且"       |
    16. | but (code)       | "但是"       |

Copying and pasting scenarios to use different values quickly becomes 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, using Scenario Outline, Examples with tables and < > delimited parameters:

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 (not counting the first row).

The way this works is via placeholders. Placeholders must be contained within < > in the Scenario Outline's steps. For example:

Given <I'm a placeholder and I'm ok>

The placeholders indicate that when the Examples row is run they should be substituted with real values from the Examples table. If a placeholder name is the same as a column title in the Examples table then this is the value that will replace it.

You can also use placeholders in Multiline Step Arguments.

IMPORTANT: Your step definitions will never have to match a placeholder. They will need to match the values that will replace the placeholder

So when running the first row of our example:

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

The scenario that is actually run is:

Scenario: controlling order
Given there are 12 cucumbers # <start> replaced with 12
When I eat 5 cucumbers # <eat> replaced with 5
Then I should have 7 cucumbers # <left> replaced with 7 ---------------------------------------------------------------------------------------- 场景大纲:输入产品ID并验证
  假如 打开首页
  而且 输入<<ProdID>> #双尖括号
 
例子:产品ID                  #"产品ID"是自定义的
    |ProdID|
    |111111|
    |222222|
    |333333|
    |444444|

Cucumber 场景大纲 Scenario Outlines的更多相关文章

  1. Cucumber capybara 每个Scenario登陆一次

    hook.rb中添加: After do |scenario| Capybara.current_session.instance_variable_set(:@touched, false)end ...

  2. cucumber java从入门到精通(4)Scenario Outline及数据驱动

    cucumber java从入门到精通(4)Scenario Outline及数据驱动 到目前为止,我们的TodoList类工作良好,不过离我们的预期--任务清单系统还是有不少差距,究其原因不过如下: ...

  3. 场景设计以及Manual Scenario和Goal-OrientedScenario的区别

    Manual Scenario 手工场景 主要是设计用户变化,通过手工场景可以帮助我们分析系统的性能瓶颈.手动方案:如果要生成手动方案,请选择此方法.通过创建组并指定脚本.负载生成器和每组中包括的 V ...

  4. uiautomator+cucumber实现自动化测试

    前提 由于公司业务要求,所以自动化测试要达到以下几点: 跨应用的测试 测试用例可读性强 测试报告可读性强 对失败的用例有截图保存并在报告中体现 基于以上几点,在对自动化测试框架选型的时候就选择了uia ...

  5. 行为驱动:Cucumber + Selenium + Java(一) - Cucumber简单操作实例

    场景(Scenarios) 场景是Cucumber结构的核心之一.每个场景都以关键字“Scenario:”(或本地化一)开头,后面是可选的场景标题.每个Feature可以有一个或多个场景,每个场景由一 ...

  6. cucumber java从入门到精通(1)初体验

    cucumber java从入门到精通(1)初体验 cucumber在ruby环境下表现让人惊叹,作为BDD框架的先驱,cucumber后来被移植到了多平台,有cucumber-js以及我们今天要介绍 ...

  7. uiautomator+cucumber实现移动app自动化测试

    前提 由于公司业务要求,所以自动化测试要达到以下几点: 跨应用的测试 测试用例可读性强 测试报告可读性强 对失败的用例有截图保存并在报告中体现 基于以上几点,在对自动化测试框架选型的时候就选择了uia ...

  8. Cucumber常用关键字

    常用关键字(中英文对应) 对应的测试用例 Feature(功能) test suite (测试用例集) background(背景)   Scenario(场景) test case(测试用例) Sc ...

  9. cucumbe无法识别中文场景的问题

    import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucu ...

随机推荐

  1. js---window对象的三种窗口

    ============================================================================ window对象的三种窗口.html < ...

  2. Material使用10 MdRadioModule、MdDatepickerModule、MdNativeDateModule、MdSelectModule

    1 MdRadioModule 相当于<input type="radio"> 2 使用步骤 2.1 在共享模块导入MdRadioModule import { NgM ...

  3. [原创]SQL 表值函数:获取从今天计算起往前自定义天数

    PS:此博文是利用Windows Live Writer 2012编写,格式效果可能不太好. 在我开发过程中,遇到一个统计需求,结果是要求返回从当天起往回推算出自定义输入的天数 为此我写了一个表值函数 ...

  4. ubuntu 13.04 安装 JDK

    ubuntu 13.04 安装 JDK 具体步骤参详了如下链接: http://blog.csdn.net/yang_hui1986527/article/details/6677450 1.到 Su ...

  5. Java引用的四种状态

    强引用 用的最广,我们平时写代码时,new一个Object存放在堆内存,然后用一个引用指向它.它就是强引用. 如果一个对象具有强引用,那么垃圾回收期绝不会回收它,当内存空间不足,java虚拟机宁愿抛出 ...

  6. Django 之 auth 模块

    Django 内置一个 auth 模块,帮助用户实现注册.登录.注销以及修改密码等功能,帮助开发者省去了很多功夫. auth 模块 在创建模型时,Django内部会生成一个名为 auth_user 的 ...

  7. uWSGI + Nginx + Django 部署

    1. uWSGI 服务器 Django 默认使用 WSGI(Python Web Server Gateway ) 作为 Web 服务器,一般仅用来作为测试使用,实际生产环境而是使用 uWSGI 和 ...

  8. webpack@3.6.0(4) -- 配置模块化开发

    本篇内容 watch 版权插件 hash.chunkhash.contenthash的区别 watch 修改文件时自动打包 webpack --watch //webpack.config.js,与d ...

  9. 2017乌鲁木齐区域赛A(动态规划,组合数学,期望)

    #include<bits/stdc++.h>using namespace std;double c[110][110];double g[110];double dp[110][110 ...

  10. uoj #5. 【NOI2014】动物园

    #5. [NOI2014]动物园 近日,园长发现动物园中好吃懒做的动物越来越多了.例如企鹅,只会卖萌向游客要吃的.为了整治动物园的不良风气,让动物们凭自己的真才实学向游客要吃的园长决定开设算法班,让 ...