Specflow - How to pass parameter in Scenario outline description

99封情书 提交于 2020-01-06 03:14:26

问题


Please can you help me in providing an solution on how to pass parameter in Scenario outline description of Spec Flow? Please see below for an example:

Scenario Outline : Testing **<Application>**
    Given I navigate to <Application>
    Then I should see Home page

    Examples:
    | Application |
    | Test        |
    | Test1       |

I know this is possible in Cucumber but don't know the way to do it in Specflow. Appreciate your response. Thanks in advance.


回答1:


There is no benefit in doing this. Just write a generic scenario title that explains the use case:

Scenario Outline: Navigating to the home page
    Given I navigate to <Application>
    Then I should see Home page

Examples:
    | Application    |
    | Stack Overflow |
    | Math Overflow  |

SpecFlow will append the the test name with data from the first column of your examples table:



来源:https://stackoverflow.com/questions/55103909/specflow-how-to-pass-parameter-in-scenario-outline-description

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!