嗨,我有一个场景,需要测试搜索服务是否带回正确的结果。所以我的故事看起来像这样:

Narrative:
In order to easily discover if a player is registered in a loyalty program
As a customer service representative
I want to be able to search for registered players by player first and last name

Scenario: Retrieve Player information by First and Last Name

Given players registered in the Data Warehouse and some combination of Loyalty1 and/or Loyalty2 programs:
|first name|last name|city     |province|loyalty1 |loyalty2|
|Pete      |Walter   |Winnipeg |<null>  |false    |true    |
|Jon       |Dewit    |Winnipeg |MB      |true     |true    |
|John      |Dewit    |<null>   |<null>  |true     |true    |
|Peter     |Dewalt   |<null>   |<null>  |true     |false   |

When the <firstnamecriteria> and <lastnamecriteria> criteria are specified

Then the system displays the correct results, using a case-insensitive "begins with" search as follows:
|firstnamecriteria|lastnamecriteria|results               |
|Jo               |                ||first name|last name||
|                 |                ||Jon       |Dewit    ||
|                 |                ||John      |Dewit    ||

Examples:
|firstnamecriteria|lastnamecriteria|
|Jo               |                |
|                 |Dew             |
|J                |D               |


“ Then”部分下的表将继续运行一段时间,使用“姓氏/姓氏”条件的不同排列,然后在“结果”列中嵌套预期结果的嵌套表。 “示例”部分将包含传递给“何时”部分的可能搜索条件的列表

是否可以有这样的嵌套表?如果没有,也许我可以使用另一种方法来完成同一件事?

最佳答案

据我了解,它不直接支持-尽管获取ExampleTable值作为Parameters会在ParameterConverters中启动-默认情况下会设置其中的ExampleTable ParameterConverter。我确定里面有一个解析错误。

就是说,您的“ Then”需要适用于Example:部分的所有行。我敢肯定,这就是为什么您要考虑将所有内容都放入“ Then”中的原因-然后您可以挑选出正确的内容。

您可以执行以下操作:

Given players registered in the Data Warehouse and some combination of Loyalty1 and/or Loyalty2 programs:
|id|first name|last name|city     |province|loyalty1 |loyalty2|
|1 |Pete      |Walter   |Winnipeg |<null>  |false    |true    |
|2 |Jon       |Dewit    |Winnipeg |MB      |true     |true    |
|3 |John      |Dewit    |<null>   |<null>  |true     |true    |
|4 |Peter     |Dewalt   |<null>   |<null>  |true     |false   |
When the <firstnamecriteria> and <lastnamecriteria> criteria are specified
Then the system displays the correct results, using a case-insensitive "begins with" search with users <userlist>

Examples:
|firstnamecriteria|lastnamecriteria|userlist|
|Jo               |                |2,3     |
|                 |Dew             |2,3,4   |
|J                |D               |2,3     |

10-02 02:42
查看更多