gpt4 book ai didi

c# - 如何获取场景名称和参数?规范流

转载 作者:太空狗 更新时间:2023-10-29 18:16:01 25 4
gpt4 key购买 nike

this question scenario.getName 用于场景的名称。除了参数之外,我还需要获取名称。例如,如果场景是:

Scenario Outline: name of scenario
Given I am on the proper page
When I apply <filter> with <params>
And I click filter
Then the data should be filtered
Examples:
| filter | params |
| Date | Today |
| Name | Some Name |

我想获取 nameOfScenario(Date,Today)。

此外,我使用的是 C# 而不是 java

更新

我知道当我用 NUnit 打开测试用例时,它们显示为 nameOfScenario(Date,Today)。知道 Nunit 是如何做到的吗?

最佳答案

请随意使用 TestContext.CurrentContext.Test.Name——它肯定会帮助您获得准确的参数化场景名称。

Specflow 在运行时不带参数,它是 NUnit(或其他单元测试框架)的责任。

至少您可以探索 TestContext.CurrentContext.Test 属性以获取参数列表。

关于c# - 如何获取场景名称和参数?规范流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28742668/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com