Search code examples
cucumberbddcucumber-javafeature-file

Cucumber Step Definitions not fetching parameter value correctly


I am trying to execute my cucumber test scenarios using Scenario Outline and Examples. As part of that, i am passing my parameters as <parameter> and giving the values in examples like :

    | val1      |
    | val2      |

but when i am running my tests with a basic print, then it is printing <paramter>, if i change the regex then it prints parameter. In simple words it is taking "parameter" as string instead of values provided in the Examples like val1, val2.

any idea why this might be happening?

PS i already tried "<parameter>" instead of <parameter> and {string} instead of regex


Solution

  • It was a silly mistake that it had put the examples data table in the same line as Examples :

    Examples : | param1 | param2 |
               | val1   | val2   |
    

    instead i had to put it like this.

    Examples :
             | param1 | param2 |
             | val1   | val2   |
    

    and now it works fine.