lundi 1 juin 2020

Use PhpStorm to automate API testing

I am using PhpStorm to automate my API testing. I have a response data format like:

{"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"}]}}

From here, I want to read the name data to compare for testing API as below

 client.test("check_store", function() {
    client.assert(response.body.data.name=== "store", "store not found");  
 });

I am not sure about the format of response.body.data.name. Is there anyone help me to do that.

Aucun commentaire:

Enregistrer un commentaire