提问者:小点点

无法访问场景大纲示例的值


我试图在我的步骤定义中访问我的场景大纲示例,但我无法访问。

这是我的特点和场景…

功能:验证电子邮件背景:假设我在“https://www.somewebsite.com”场景大纲:确认电子邮件地址

鉴于我在电子邮件字段中填写“当我提交表格时,我应该看到”

示例: | | | | | 电子邮件是必需的||无效@|电子邮件必须有效||valid@gmail.com|成功页|

这是我的步骤定义…

/**
 * @Given /^I fill in the email field with “(.*)”$/
 */
public function iFillInTheEmailFieldWith($email_value)
{
echo("email =====");
    echo($email_value);

}
  • 输出是它打印标题名称。

它没有获取电子邮件的实际值(例如无效@、valid@gmail.com等),而是给了我字面标题名称

我在这里做错了什么?请帮助…


共1个答案

匿名用户

欢迎来到SO。这里我认为场景文件在这里写得不正确。下面是正确的方法。你必须在像这样的引号中指定列名"

Feature: verify email Background: Given I am on “https://www.somewebsite.com”

Scenario Outline: Confirm email address
Given I fill in the email field with "<email_value>"
When I submit the form Then I should see "<message>"

Examples:
  | email_value     | message             |
  |                 | email is required   |
  | invalid@        | email must be valid |
  | valid@gmail.com | success page        |