当我在量角器黄瓜的步骤定义的 when 部分中定义 {string} 参数时变得不确定

Getting undefined when I define {string} parameter in the when section in the step definition in protractor cucumber

我是黄瓜量角器的新手。我必须自动化一个流程,其中在输入名字、姓氏和邮政编码时,会创建一个新用户。我正在尝试将要输入到场景大纲示例中的特征文件中的数据添加如下:

Feature: Demo
            Scenario Outline: Create a customer
                Given I open the application and click on create customer button
                When I enter <firstName>, <lastName>, <postCode>
                Then customer should be created

Examples:
            | firstName | lastName | postCode |
            | Saloni    | Singhal  | 12345  |
            | Harry     | Potter   | 67890  |

对于when子句,我在步骤def中添加了如下代码:

When('I enter {string}, {string}, {int}', async function (string,string,int) {
    browser.sleep(10000);
   await BankManagerButton.click();
    await firstName.sendKeys(string);
    await lastName.sendKeys(string);
    await postCode.sendKeys(int);
    return await addCustButton.click();
    });

但是在 运行 这个问题上,它给我一个未定义的错误,并提出以下建议:

Undefined. Implement with the following snippet:

         When('I enter Saloni, Singhal, {int}', function (int) {
         // When('I enter Saloni, Singhal, {float}', function (float) {
           // Write code here that turns the phrase above into concrete actions
           return 'pending';
         });

所有场景都一样。那么,我是否必须为每个数据单独编写代码,还是可以在一个函数中处理?如果是,我该如何做?

https://cucumber.io/docs/cucumber/cucumber-expressions/

{string} Matches single-quoted or double-quoted strings, for example "banana split" or 'banana split' (but not banana split). Only the text between the quotes will be extracted. The quotes themselves are discarded. Empty pairs of quotes are valid and will be matched and passed to step code as empty strings.

所以:

When I enter "<firstName>", "<lastName>", "<postCode>"