当我尝试使用下面的功能时,我得到 必需的请求部分"文件"不存在功能:验证 API 是否正确返回产品
Background:
* url 'http://localhost:8080'
Scenario: Products are returned on post
Given path 'upload'
And multipart field files = read('test.txt')
When method post
Then status 200
And match $ == {error: false, bytesUploaded:'#notnull'}
请为文件上传API测试提出适当的解决方案或替代方案
请参阅multipart file
文档:https://github.com/intuit/karate#multipart-file
Given path 'upload'
And multipart file files = { read: 'test.txt', filename: 'test.txt', contentType: 'text/plain' }
When method post
Then status 200
And match $ == { error: false, bytesUploaded: '#notnull' }