Pavan Gurram
Pavan Gurram

Reputation: 11

Specflow - How to pass parameter in Scenario outline description

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.

Upvotes: 1

Views: 1395

Answers (1)

Greg Burghardt
Greg Burghardt

Reputation: 18928

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:

Screenshot of Visual Studio Test Explorer panel showing test names

Upvotes: 3

Related Questions