1

As Per https://github.com/intuit/karate#data-driven-features when we pass a JSON array as an argument to the call of another feature file, the feature is invoked for each item in the array.

Is there a way to avoid this? I want to consider the complete JSON array as my request for another feature file Example:

[
 {
   "attr1" :"123",
   "attr2" :"456"
 },
 {
   "attr1" :"789",
   "attr2" :"101112"
 }
]

I'm currently passing this payload to another feature file as:

* call read('classpath:com/example/Test.feature') myReq

Now my Test.feature gets executed twice, once for each item in the JSON array. But my complete JSON array is to be passed as Request to Test.feature. How can we achieve this?

1 Answer 1

1

Wrap it:

* def array = []
* def arg = { data: '#(array)' }
* call read('classpath:com/example/Test.feature') arg
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.