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

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

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

4

1 回答 1

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

}
于 2013-11-07T12:27:25.597 回答