我得到了这样的回应。
"{\"statusCode\":204,\"output\":\"{\\n \\\"Id\\\" : \\\"884d39b8-4afc-4ee3-807a-9d6dbde8c390\\\",\\n \\\"temp\\\" : \\\"33\\\",\\n \\\"lastUpdateAuthor\\\" : null\\n}\"}"
Run Code Online (Sandbox Code Playgroud)
我怎样才能解析这个响应并做类似的事情
* def expectedOutput =
"""
{
"Id": "884d39b8-4afc-4ee3-807a-9d6dbde8c390",
"temp": "33",
"lastUpdateAuthor": null
}
Scenario: Testing a PUT endpoint with request body
Given path 'v0'
And request input
When method put
Then match status 200
And match JSON.parse(JSON.parse(response).output) == expectedOutput
Run Code Online (Sandbox Code Playgroud)
最后一行代码被空手道跳过了。
有什么意见吗?
想通了。
* def expectedOutput =
"""
{
"Id": "884d39b8-4afc-4ee3-807a-9d6dbde8c390",
"temp": "33",
"lastUpdateAuthor": null
}
"""
Scenario: Testing a PUT endpoint with request body
Given path 'v0'
And request input
When method put
Then match status 200
And json convertJSON = $
And json convertJSON = convertJSON.output
And match convertJSON.latitude == expectedOutput
Run Code Online (Sandbox Code Playgroud)
有效。
| 归档时间: |
|
| 查看次数: |
5169 次 |
| 最近记录: |