c# - c# SpecFlow,如何从 ScenarioContext(或其他测试上下文)获取场景中的示例行索引
问题描述
在 c# SpecFlow 中,例如在 AfterScenario 方法中,我可以将 Scenario Title 获取为ScenarioContext.Current.ScenarioInfo.Title
如果场景包含许多示例(在 Gherkin 功能文件的意义上)并且我想获取示例上下文,让我们说它在示例列表中的索引。我怎样才能找到它?我必须在测试开始时设置它吗?如果是,如何以及在哪里?
以下是 Gherkin 场景的示例:
Scenario Outline: a scenario
Given The user '<UserName>'
When He opens the
Then The he should
Examples:
| UserName |
| user1 |
| user2 |
谢谢!
解决方案
推荐阅读
- wpf - WPF前台继承
- image-processing - 位操作有什么用?
- abap - SAP ABAP中的这个运算符是什么意思“(+)=”
- google-cloud-platform - 如何使用开发人员 Google 帐户而不是服务帐户向 ESP 进行身份验证?
- matlab - 使用 MATLAB 求解方程
- jquery - 如何在 Django 中为 4 个嵌套的一对多关系制作表单并添加数据?
- database - Oracle 11g,orapwd.exe 打不开
- python - 在范围函数 Python 中使用自定义顺序
- python - python脚本中的ListRecommendationsRequest构造函数错误
- reactjs - 如何在不重新渲染站点或使用 MuiThemeProvider 的情况下更改材质 ui 元素的颜色