1
votes

I need to create kittens like in this example: https://github.com/intuit/karate/blob/master/karate-demo/src/test/java/demo/calltable/call-table.feature. But I need to increment names like name1 and age1, name2 and age2, name3 and age3... and not put the names and ages in the table kittens. How I can do this? thanks

1

1 Answers

1
votes

When you call a feature using a JSON array - which will call the feature in a loop, within the called feature, you have access to a special built-in variable called __loop.

Refer to the documentation here: Built in variables for call

So you can do things like { name: "#('Name' + __loop)" }

(edit): apparently the above was too confusing :/, let me try another suggestion. Please look at this example: call-dynamic-json.feature

You can see how you can have 100% control of creating kittens in a loop instead of using a table. All the best :P