Search code examples
cucumberqaf

Cucumber gherkin use different data files in the same scenario


Really hope someone can help on this.

Is it possible to use 2 different external data files in the "Examples" in cucumber? like below:

@play_movie

Scenario Outline: play a video on the web site

When I choose a movie by "<movie_name>" and play

Examples: {'datafile' : 'src/main/resources/data/testData.xls' , 'sheetName' : 'movie_demo'}

There is one data file in this scenario, but what if I want to use 2 or more different data files in this scenario. Is it possible to do that in cucumber?

I'm using Java as the coding language.

Thanks.


Solution

  • Short answer is no, you can use only one external source at a time. You can paremeterize it but still it will be one source as result.

    However, it's not that you can't do! You can have your custom data provider which can read multiple sources and returns test data.