【问题标题】:how to provide data in specflow如何在specflow中提供数据
【发布时间】:2015-04-02 09:36:28
【问题描述】:

我有一个场景大纲:specflow 中的部分,我想在示例中提供数据:部分 问题是我有两个参数,一个在 Given 中,另一个在 Then ie 中。

Given: I have a value <input1>
And: trigger 
Then: the result should be <input2>

两个输入的值不一样,那么我应该如何将这些值放入表中?

|input1|input2|
|one   |one   |
|two   |two   |
|three |
|four  |

我尝试在谷歌上搜索,但没有找到任何解决方案。

【问题讨论】:

    标签: specflow gherkin


    【解决方案1】:

    这不起作用吗?我不确定我是否理解问题所在

    Scenario Outline:
        Given I have a value <input>
        And trigger 
        Then the result should be <expectedResult>
    
    Examples:
        |input | expectedResult|
        |one   | 1             |
        |two   | 2             |
        |three | 3             |
        |four  | 4             |
    

    【讨论】:

    • 因为 input1 是我对 web 服务的输入,而 input2 是我的响应。如果我将两者都这样放置,那么我的定义文件将如何检测哪个是输入,哪个是输出。
    • 对不起,我误解了这个问题。我已经更新了我的答案。你的解决方案不起作用怎么办?
    猜你喜欢
    • 2019-05-22
    • 2017-08-04
    • 1970-01-01
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    • 2022-07-08
    • 2020-11-20
    • 1970-01-01
    相关资源
    最近更新 更多