【发布时间】:2021-03-06 22:21:28
【问题描述】:
我有一个以表格格式显示数据的 UI。该表有 9 列。我需要编写 BDD 场景来验证所有这些列的名称。我不确定以下哪种方法是正确的。(仅包括导航到所需 UI 后的最后一个“Then”语句)
方法一:
Then UI should include bill details in tabular format with "Bill ID" "Payment Type" "Facility Name" "BillAccount/Master Account" "Supplier Name" "Statement Date" "Due Date" "Total Amount Due" and "Bill Image" columns
步骤定义:
[Then(@"UI should include bill details in tabular format with ""(.*)"" ""(.*)"" ""(.*)"" ""(.*)"" ""(.*)"" ""(.*)"" ""(.*)"" ""(.*)"" and ""(.*)"" columns")]
public void ThenUIShouldIncludeBillDetailsInTabularFormatWithAndColumns(string p0, string p1, string p2, string p3, string p4, string p5, string p6, string p7, string p8)
这里我可以使用字符串 p0 值直接获取期望的列名,并与实际值进行比较。我可以对所有 9 个列名做同样的事情
方法二:
Then UI should include bill details with below columns
| col1 | col2 | | col3 | col4 | | col5 | col6 | | col7 | col8 | col9 |
| Bill ID | Payment Type | | Facility Name | BillAccount/Master Account | | Supplier Name | Statement Date | | Due Date | Total Amount Due | Bill Image |
在这种方法中,我需要知道读取作为参数值提到的列名的最佳方法。一种选择是创建一个包含 9 个字符串字段的自定义类,并在 table.createInstance() 方法中使用相应的类。
请给我建议最好的方法。
【问题讨论】:
标签: cucumber bdd specflow gherkin