Skip to main content
deleted 47 characters in body
Source Link
PDHide
  • 11.1k
  • 2
  • 16
  • 43

This is an interesting observation , if you mix string and int together then you have wrap string with quotes.You have to wrap string with quotes in your feature file,

Feature File:

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  |

Also: you need define parameters and not parameter type:

Step Definition:

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

How will you know what 'string' is passed if you don't give separate name for parameters.

This is an interesting observation , if you mix string and int together then you have wrap string with quotes.

Feature File:

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  |

Also: you need define parameters and not parameter type:

Step Definition:

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

How will you know what 'string' is passed if you don't give separate name for parameters.

You have to wrap string with quotes in your feature file,

Feature File:

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  |

Also: you need define parameters and not parameter type:

Step Definition:

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

How will you know what 'string' is passed if you don't give separate name for parameters.

Source Link
PDHide
  • 11.1k
  • 2
  • 16
  • 43

This is an interesting observation , if you mix string and int together then you have wrap string with quotes.

Feature File:

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  |

Also: you need define parameters and not parameter type:

Step Definition:

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

How will you know what 'string' is passed if you don't give separate name for parameters.