Thucydides + Jbehave中的表格参数

时间:2013-11-06 16:11:29

标签: java jbehave thucydides

我有以下代码:

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)
{
   ...
}

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

我的问题是,当我运行测试时,函数使用“&gt; loginName&gt;”而不是所需的参数。字符串,尽管每个例子都有一个场景,我看到它正在映射它们(例如&gt; loginName&gt; = admin)。

1 个答案:

答案 0 :(得分:0)

正确的语法是:

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)
{
    ...

}