步骤定义中的调用步骤

时间:2019-03-27 06:57:57

标签: typescript protractor cucumber

我正在创建一个功能文件,以从其他场景调用其他步骤。请找到以下内容,并提出建议,以防丢失。

功能文件:

功能:测试多个步骤

Scenario: Print All console
    Given Print the start console
    Given Print All console
do
step "Print the console for numbers"
step "Print first numbers console"
step "Print second numbers console"
end

Scenario: Print All console
    Given Print the console for numbers
    Then Print first numbers console
    Then Print second numbers console

步骤定义:

import { Then, Given } from 'cucumber';

Given(/^Print the start console$/, async () => {
    console.log('------Printing console-----');
});


Then(/^Print All console$/, async () => {
    console.log('------Printing all console-----');
});


Given(/^Print the console for numbers$/, async () => {
    console.log('------Printing console for numbers-----');
});


Then(/^Print first numbers console$/, async () => {
    console.log('------Printing first number console-----');
});

Then(/^Print second numbers console$/, async () => {
    console.log('------Printing second number console-----');
});

在执行过程中,我收到如下错误。请帮忙。

[12:21:35] E /启动程序-错误:错误:解析“ src \ features \ multipleSteps.feature”中的错误:(6:5):预期:#EOF,#TableRow,#DocStringSeparator,#StepLine ,#TagLine,#ScenarioLine,#ScenarioOutlineLine,#Comment,#Empty,得到了“做”


1 个答案:

答案 0 :(得分:0)

您可以使用方案大纲 喜欢:

方案概述:“全部打印”控制台

Given Print the start console

Given Print All “<console>”

示例:

|控制台|

|打印控制台中的数字|

|打印第一个数字控制台|

|打印第二个数字控制台|

在这里参考: Cucumber scenario outline and examples with generic step definitions