I have a below use case in API automation framework which was built using karate I store my request payload as a JSON file under the test payload folder under classpath and I tried to update values for a couple of keys (using SET keyword, print shows the updated request JSON) before posting the request using and then I have called the same file as multipart form data when I execute it, set keyword updates the requested keys in the request payload but while posting it uses the file with old values can someone guide me on how to dynamically update the request payload and use the same file as multipart form data in post request using karate
Background:
* url baseurl
* header accept = '*/*'
@test
Scenario Outline: to test with different data
given path 'v1/api/'
And def RequestBody = read('classpath:testpayload/<Testtype>.json>')
And set RequestBody.orderID = '280120221234'
And set RequestBody.subdate = '<submitteddate>'
And print 'reqpl:', RequestBody
And multipart field testdata ={read:'classpath:testpayload/<Testtype>.'json',filename:<Testtype>.'json', contentType: 'multipart/form-data'}
And method post
Then status 200
Examples:
|Testtype |submitteddate|
|test1data|28012022 |
``````````````````````````````