3

I want to know if it's possible to put scenario in a loop?
Imagine I have a scenario that I want to test it 10 times with 10 different data in a list. It's a good Idea to put whole scenario in a loop and even set scenario name in the loop. Is it possible?

ehsan shirzadi
  • 4,709
  • 16
  • 69
  • 112

1 Answers1

4

Yes, this is what Karate's data-driven call does. You need to split code into a second feature file (with only one scenario).

Here is the link to the documentation: Data Driven Features.

And in the karate demos look at the examples call-json-array.feature and call-table.feature.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • 2
    Thomos, 'call-json-array.feature' is just awesome example. It made testers life simple from complex programming world . – Anupama Mar 12 '19 at 09:16
  • @Anupama great ! make sure you read the docs on the new “dynamic scenario outline” also – Peter Thomas Mar 12 '19 at 10:41