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?
Asked
Active
Viewed 6,901 times
3

ehsan shirzadi
- 4,709
- 16
- 69
- 112
-
@PeterThomas OK peter, Thanks to you previous answers, I will check them soon, Is it possible to answer this question too? – ehsan shirzadi Nov 02 '17 at 14:35
1 Answers
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
-
2Thomos, '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