黄瓜不从场景大纲中读取数据 [英] Cucumber does not read data from scenario outline

查看:247
本文介绍了黄瓜不从场景大纲中读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下情景概要

 Background:
   Given customer is in hot or not page

 Scenario Outline: Hot article
  And customer enters <name>
  And submits
  And customer clicks thumbs up
  Then ensure the TBD

 Examples:
  | name |
  |  Elliot |
  |  Florian |

并执行以下步骤 -

and following step implementation -

@And("customer enters <name>")
public void customer_enters_name(String name) throws Throwable {
    // Express the Regexp above with the code you wish you had
    Thread.sleep(10000);
}

但是当我执行测试时,我得到以下错误 -

But when I execute test then I get following error -

您可以使用以下代码段实现缺失的步骤:

You can implement missing steps with the snippets below:

@Given("^customer enters Elliot$")
public void customer_enters_Elliot() throws Throwable {
  // Express the Regexp above with the code you wish you had
  throw new PendingException();
}

@Given("^customer enters Florian$")
 public void customer_enters_Florian() throws Throwable {
  // Express the Regexp above with the code you wish you had
  throw new PendingException();
}

我实施测试步骤有误吗?

Did I implement test steps wrong?

推荐答案

而不是

 Scenario Outline: ...
  And customer enters <name>
  ...

这样做(注意双引号)

 Scenario Outline: ...
  And customer enters "<name>"
  ...

这篇关于黄瓜不从场景大纲中读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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