Search code examples
node.jscucumbercucumberjs

Angular bracket arguments don't get replaced in Cucumber Feature file after completion of execution in cucumber js


I'm using cucumber js with node js and webdriverio.

I have written hooks in step definition file like..

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

I have used Feature file as follows

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

After execution , reports are generated like.. and in feature file is not replaced with actual values

enter image description here


Solution

  • If you need to take multiple user names and passwords:

    1) We need to declare it as Scenario Outline instead only Scenario 2) We need to create a Scenario Outline in below format:

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

    By this way, our scenario will be repeated with multiple examples what we are proving in Examples table shown like above.