Reputation: 391
These are my fields in form-data
uploaded_by = [email protected]
status = true
file = Excel File to be uploaded
Here is the code I tried
Given url baseUrl + uploadTemplate
And multipart field uploaded_by = <user>
And multipart field status = <status>
And multipart field file = read('Template.xlsx')
When method post
Then status 200
And match $.result == <result>
Examples:
| user | status | result |
| '[email protected]' | true | INITIAL |
Excel File is present in the same location where feature file is there , I am getting 500 error , But working well from POSTMAN
Upvotes: 2
Views: 5150
Reputation: 391
It worked with following code
Given url baseUrl + uploadTemplate
And multipart field uploaded_by = <user>
And multipart field status = <status>
And multipart field file = { read: 'Template.xlsx', filename: 'Template.xlsx', contentType: 'multipart/form-data' }
When method post
Then status 200
And match $.result == <result>
Upvotes: 0
Reputation: 58058
Use form field
instead of multipart field
: https://github.com/intuit/karate#form-field
Upvotes: 3