英文:
Karate API - Could not pass the variable value in the path
问题
我正在尝试传递AppraisalID的变量值,但它没有被识别。请帮忙。
给定路径'/products/propertyedge/appraisal'
并且请求'{ "valuationId":"372629" }'
当方法为Post
那么状态为201
* 定义 location = responseHeaders['Location'][0]
* 定义 appraisalId = location.substring(location.lastIndexOf('/') + 1)
* 输出 appraisalId
给定路径 'products/propertyedge/appraisal/{appraisalId}'
并且参数 action = 'view'
当方法为Get
那么状态为200
并且断言 response.appraisalId == <appraisalId>
#karate #api
尝试使用场景大纲变量<>, 但没有成功。请帮忙。
英文:
I am trying to pass the variable value of AppraisalID but it is not recognized. Please help
Given path '/products/propertyedge/appraisal'
And request '{"valuationId":"372629"}'
When method Post
Then status 201
* def location = responseHeaders['Location'][0]
* def appraisalId = location.substring(location.lastIndexOf('/') + 1)
* print appraisalId
Given path 'products/propertyedge/appraisal/{appraisalId}'
And param action = 'view'
When method Get
Then status 200
And assert response.appraisalId == <appraisalId>
#karate #api
Tried with scenario outline variable <> but in vain. Please help
答案1
得分: 1
给定路径 'products/propertyedge/appraisal', appraisalId.
英文:
Please read the docs: https://github.com/karatelabs/karate#path
Given path 'products/propertyedge/appraisal', appraisalId
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论