1

Was going through Specflow-How to pass parameter in scenario outline description and wonder how to pass parameter in Scenario outline description in ?

Let's use the same example from other post.

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

    Examples:
    | Application |
    | Test        |
    | Test1       |
    | Test2       |

This will be helpful when user generate the consolidate report with Report Builder to show each scenario outline as a separate scenario with the application name rather showing Testing <Application>.

Actual Sample Report: Without parameter updated to scenario outline enter image description here

Expected Sample Report: All we need is to update <Application> based on example table data

enter image description here

Appreciate any detailed explanation.

supputuri
  • 13,644
  • 2
  • 21
  • 39
  • I've had a look at the possibilities, mainly in After scenario to overwrite the scenario title. But I can't find any functionality to dynamically catch the variable and paste it in there. It's also lacking in the JSON output, so it seems like it's not possible. I'd recommend creating a ticket here https://github.com/cucumber/cucumber-ruby/issues . – Gijs P Jun 24 '19 at 10:28

1 Answers1

0

Programming feature files in this way is something that goes against the design and implementation of Cucumber. If you need to program feature files you should either

1) Program outside of cucumber i.e. use to script to run multiple instances of cucumber

OR

2) Push the programming down into step definitions or better yet helper methods called by step definitions.

In your case you could perhaps use a script to physically change the text in the feature file before cucumber runs it for each application.

diabolist
  • 3,990
  • 1
  • 11
  • 15
  • Thanks for thoughts, but we have to validate 100's/1000's of the rows and all the rows will be populated by the dynamically from based on another feature execution. Right now are able to run and generate the reports successfully, the only pain point is when the scenario failed we have to open the report to see which particular combination failed. I know we can create individual scenarios with specific description for each of them. But that's not what I am looking for as it's going to be big file with repeated steps on on the `.feature` file, which would be uncomfortable for BA and testers too. – supputuri Jul 09 '19 at 03:03