-1

below is the sample request. One parameter I have managed to pass it as example and other is a son array.

{request;{ first:value1, second:[value1,value2] }}

1 Answers1

0

Read the docs: https://github.com/intuit/karate#embedded-expressions

* def v1 = 'value1'
* def arr = [ 'value1', 'value2' ]
* def body = { first: '#(v1)', second: '#(arr)' }
* match body == { first: 'value1', second: [ 'value1', 'value2' ] }

EDIT - yes you can use JSON in examples: https://github.com/intuit/karate#scenario-outline-enhancements

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248
  • Thanks, Peter .. I trying to run the above for multiple test data with the above approach I have to declare the test data I m trying to find out the way to read the JSON array from JSON file. Is it possible to add the JSON file in the examples? I also have a put request data where it is nested json object which I m trying to construct dynamically rather having request file designed – renuka prasad Jun 30 '20 at 15:32