我正在使用PhpStorm自动化我的API测试。我有一种响应数据格式,如:
{"status":"OK","result":{"data":[{"id":2,"name":"store","slug":"store"},
{"id":51,"name":"store-1","slug":"store-1"},{"id":76,"name":"store-2","slug":"store-2"},
{"id":60,"name":"test-drive","slug":"Test Drive"},
{"id":52,"name":"commencal","slug":"Commencal"}]}}从这里开始,我希望阅读名称数据来进行测试,如下所示
client.test("check_store", function() {
client.assert(response.body.data.name=== "store", "store not found");
});我不确定response.body.data.name的格式。有人帮我这么做吗。
发布于 2020-06-01 12:52:33
我已经解决了这个问题,并希望与其他人分享。写完下面的陈述后,问题已经解决了。response.body.result.data.name
https://stackoverflow.com/questions/62130427
复制相似问题