使用PhpStorm自动化API测试

使用PhpStorm自动化API测试,api,testing,phpstorm,jetbrains-ide,Api,Testing,Phpstorm,Jetbrains Ide,我正在使用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"},

我正在使用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"}]}}
从这里,我想读取名称数据,以便对测试API进行比较,如下所示

 client.test("check_store", function() {
    client.assert(response.body.data.name=== "store", "store not found");  
 });
我不确定
response.body.data.name的格式。

有人帮我吗。

我已经解决了这个问题,想和其他人分享。在写了下面的陈述之后,问题已经解决了。
response.body.result.data[0].name

感谢您的分享:对其他类似情况的人很有用。另外,你可以稍后批准自己的答案——当其他人正在寻找类似的东西时,你会增加更多的可见性/权重。