在Cucumber js中执行完成后,不会在Cucumber Feature文件中替换尖括号参数

问题描述 投票:0回答:1

我正在将Cucumber JS与Node JS和Webdriverio一起使用。

我在步骤定义文件中写了钩子,如..

Given(/^I login with username (.*) and password (.*)$/, function(username,password) {
       pageModule.open();
       pageModule.Login("abc","abc");
       return Promise.resolve();
});

我已按如下方式使用功能文件

Scenario: Create New
          Given I login with username "<username>" and password "<password>"

执行后,将生成报告,如..并且功能文件中的报告不替换为实际值

enter image description here

node.js cucumber cucumberjs
1个回答
0
投票

如果需要使用多个用户名和密码:

1)我们需要将其声明为方案大纲,而不是仅方案2)我们需要以以下格式创建方案大纲:

Scenario Outline: Create New
Given I login with username <username> and password <password>
Examples:
|username|password|
|firstUserName|firstPassword|
|secondUserName|secondPassword|

通过这种方式,我们的场景将与上面示例所示的示例表中所证明的多个示例重复。

© www.soinside.com 2019 - 2024. All rights reserved.