Search code examples
javabddbrowser-automationjbehave

jBehave Tabular Parameter


So I want to use the tabular parameter feature from jBehave, but from some reason only the first column is taken into consideration.

Story

Given I login using the users $userTable
|url    |userRole   |
|http://localhost:3000  |Administrator  |
|http://localhost:3000  |User   |

Steps

@Given("I login using the users $userTable")
public void givenUrlIsAccessedUsingTable
      (@Named("userTable")ExamplesTable userTable) {
List<Map<String, String>> rows = userTable.getRows();
for (Map<String, String> row : rows) {
    setupPreconditions(row.get("url"), row.get("userRole"));
}

Actual result from report

The user column is not there.

I don't understand what I'm doing wrong?


Solution

  • Please check the first ':' is missing symbol

     @Given("I login using the users: $userTable")
    

    The second Given I login using the users: nothing here because the table under the statement is for that purpose

    Given I login using the users:
    |url    |userRole       |
    |http://localhost:3000  |Administrator  |
    |http://localhost:3000  |User           |
    

    If you are using intellij idea I suggest to use https://plugins.jetbrains.com/plugin/7268-jbehave-support

    for formatting

    One more thing: naming for tha I suggest like Given users for logging: