我希望将 table 从功能传递到步骤定义

I'm looking to pass a table from a feature to the step definition

我正在尝试编写一个可以 运行 用于多种配置文件类型的测试。我的目标是首先获取配置文件类型行,然后创建值为 true 的标签列表,然后使用 UI 中的列表断言它们(我对这部分很满意)。

我过去做过类似的事情,但不记得如何根据配置文件类型获取 table 行(这可以传递到 scenarioContext 容器)然后命名列表基于真实值

然后用户可以看到以下字段

 | profile            | label1 | label2 | 
 | customer           | true   | false  |
 | system admin       | true   | true   |

如有任何建议,我们将不胜感激。谢谢:)

List<string> expectedValues = new List<string>();

foreach(TableRow row in table.Rows)
{
    if (row[0].Equals(_scenarioContext.Get<string>(Constants.PROFILE)))
    {
        TableRow headers = row;
        foreach (KeyValuePair<string, string> header in headers)
        {
            if(header.Value.Equals("true"))
            expectedValues.Add(header.Key);
        }
        break;
    }
}