Here is my feature file , which just loads the json file and wants to iterate over the same
Background:
* def kittens = read('../json/test.json')
Scenario Outline: cat name: <name>
* print <name>
Examples:
| name |
| kittens |
Here is the output
[
{
"name": "Bob"
},
{
"name": "Wild"
},
{
"name": "Nyan"
},
{
"name": "Keyboard"
},
{
"name": "LOL"
},
{
"name": "Ceiling"
}
]
As per my understanding this should run 7 times and give me individual variable values , But its running only once and giving me full json as output .
Let me know if I am missing anything.
You are passing the list/array with a variable
name
in it, it will run only once as it interprets your entire json data as single variablename
.You should pass the array directly as below to make it as dynamic scenario outline.
For dynamic scenario outline, the variables
<name>
will actually derived from your json, if there is key in your json as"name"
. Not as the header of the list inExamples:
.Karate docs- Dynamic Scenario Outline