Search code examples
javajbehavethucydides

Tabular parameters in Thucydides+Jbehave


I have the following code:

When searching by Login Name <loginName>  as a filter
Then users only with <loginName> are displayed

Examples:
|<loginName>|
|admin|
|admin2|
|admin3|

And the following methods mapped to it.

@When("searching by Login Name $loginName as a filter")
public void searchingBySpecifiedLoginNameAsAFilter(String loginName)
{
   ...
}

@Then("users only with $loginName are displayed")
public void usersOnlyWithSpecifiedLoginNameAreDisplayed(String loginName)
{
    ...
}

My problem is that when i run the tests , instead of the desired parameters the functions use ">loginName>" string ,eventhough there is a scenario for each example,and i see that it's mapping them (Ex. >loginName> = admin ).


Solution

  • The correct syntax is :

    When searching by Login Name '<loginName>' as a filter
    Then users only with '<loginName>' are displayed
    
    Examples:
    |loginName|
    |admin|
    |admin2|
    |admin3|
    
      @When("searching by Login Name '<loginName>' as a filter")
       public void searchingBySpecifiedLoginNameAsAFilter(String loginName)
    {
        ...
    
    }