Cucumber 场景大纲 Scenario Outlines
引用链接:https://github.com/cucumber/cucumber/wiki/Scenario-Outlines
- script/cucumber --i18n zh-CN
- | feature | "功能" |
- | background | "背景" |
- | scenario | "场景" |
- | scenario_outline | "场景大纲" |
- | examples | "例子" |
- | given | "* ", "假如" |
- | when | "* ", "当" |
- | then | "* ", "那么" |
- | and | "* ", "而且" |
- | but | "* ", "但是" |
- | given (code) | "假如" |
- | when (code) | "当" |
- | then (code) | "那么" |
- | and (code) | "而且" |
- | 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的更多相关文章
- Cucumber capybara 每个Scenario登陆一次
hook.rb中添加: After do |scenario| Capybara.current_session.instance_variable_set(:@touched, false)end ...
- cucumber java从入门到精通(4)Scenario Outline及数据驱动
cucumber java从入门到精通(4)Scenario Outline及数据驱动 到目前为止,我们的TodoList类工作良好,不过离我们的预期--任务清单系统还是有不少差距,究其原因不过如下: ...
- 场景设计以及Manual Scenario和Goal-OrientedScenario的区别
Manual Scenario 手工场景 主要是设计用户变化,通过手工场景可以帮助我们分析系统的性能瓶颈.手动方案:如果要生成手动方案,请选择此方法.通过创建组并指定脚本.负载生成器和每组中包括的 V ...
- uiautomator+cucumber实现自动化测试
前提 由于公司业务要求,所以自动化测试要达到以下几点: 跨应用的测试 测试用例可读性强 测试报告可读性强 对失败的用例有截图保存并在报告中体现 基于以上几点,在对自动化测试框架选型的时候就选择了uia ...
- 行为驱动:Cucumber + Selenium + Java(一) - Cucumber简单操作实例
场景(Scenarios) 场景是Cucumber结构的核心之一.每个场景都以关键字“Scenario:”(或本地化一)开头,后面是可选的场景标题.每个Feature可以有一个或多个场景,每个场景由一 ...
- cucumber java从入门到精通(1)初体验
cucumber java从入门到精通(1)初体验 cucumber在ruby环境下表现让人惊叹,作为BDD框架的先驱,cucumber后来被移植到了多平台,有cucumber-js以及我们今天要介绍 ...
- uiautomator+cucumber实现移动app自动化测试
前提 由于公司业务要求,所以自动化测试要达到以下几点: 跨应用的测试 测试用例可读性强 测试报告可读性强 对失败的用例有截图保存并在报告中体现 基于以上几点,在对自动化测试框架选型的时候就选择了uia ...
- Cucumber常用关键字
常用关键字(中英文对应) 对应的测试用例 Feature(功能) test suite (测试用例集) background(背景) Scenario(场景) test case(测试用例) Sc ...
- cucumbe无法识别中文场景的问题
import org.junit.runner.RunWith; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucu ...
随机推荐
- numpy.zeros(shape, dtype=float, order='C')
numpy.zeros Return a new array of given shape and type, filled with zeros. Parameters: shape : int o ...
- MySQL绿色版的安装步骤
由于工作需要最近要开始研究MySQL了(看来学习都是逼出来的),本人对mysql没有研究,可以说一个小白. 下面就从安装开始吧,虽然网上关于这方面的东西很多,还是需要自己把操作过程写下来. 1.数据库 ...
- shell判断网络主机存活
判断网络主机存活企业面试题4:写一个脚本,实现判断10.0.0.0/24网络里,当前在线用户的IP有哪些(方法有很多) #!/bin/sh#[ -f /etc/init.d/functions ] & ...
- [HDU1711]KMP模板
解题关键:1.直接套kmp模板即可,注意最后输出的位置,需要在索引的位置+1. 2.next用作数组名在oj中会编译错误, 3.选用g++,只有g++才会接受bits/stdc++.h OJ中g++和 ...
- 用JSP输出Hello World
------------------siwuxie095 在 Eclipse 的 Package Explorer,右键->New-> ...
- Entity Framework Code-First(11):Configure One-to-One
Configure One-to-Zero-or-One Relationship: Here, we will configure One-to-Zero-or-One relationship b ...
- 25. CTF综合靶机渗透(17)
靶机链接 https://www.vulnhub.com/entry/the-ether-evilscience,212 运行环境 本靶机提供了VMware的镜像,从Vulnhub下载之后解压,运行v ...
- jQuery学习1
学习jQuery的过程中发现了一个博客把jquery的要点整理的很不错,摘抄其精华以备学习.感谢:http://blog.csdn.net/wph_1129/article/details/59932 ...
- Sharepoint2013商务智能学习笔记之部署AdventureWorksDW2012数据库(三)
AdventureWorksDW2012是sql server2012的样本数据库,后面做商务智能Demo会用到,所以需要下载并安装到sql server2012上,下载地址 第一步,下载数据库 第二 ...
- 如何使用visual studio 2017创建C语言项目
使用visual studio 2017创建一个C语言项目,步骤如下: (1)打开Visual Studio 2017环境后出现欢迎界面,如图1所示. 图1 Visual Studio 2017欢迎 ...