我在 Specflow 中编写了两个场景,一个用于 UI,另一个用于 API。场景和步骤定义如下:
Scenario 1:
@Regression
Scenario Outline: Add Single New External User
Given the <role> is logged on to the portal with <email> and <password>
When the <role> clicks on profile avatar
Something....
Scenario 2:
@GetClientList
Scenario Outline: GET API response for fetching list of Clients matching
criteria entered in the Search Text field
Given the <endpoint>
When I call Get method
Something....
Step Definitions:
[Given(@"the (.*) is logged on to the portal with (.*) and (.*)")]
public void GivenLoginToPortal(string role, string email, string password)
{
//Something
}
[Given(@"the (.*)")]
public void GivenTheEndpoint(string endpoint)
{
Endpoint = endpoint;
}
在这里,当我导航到第一个场景中给定语句的步骤定义时,它会显示找到多个匹配绑定的警告......并且多个匹配绑定是指第二个给定语句的步骤定义。但我相信,既然两个 Given 语句都不同,那么为什么第一个 Given 会抛出多个匹配绑定?