I have a json array coming from my api as response:
{
"data": [
{
"id": 1,
"name": "abc"
}
}
I am using laravel
for api and laravel-codeception
for testing.
public function getAll(ApiTester $I)
{
$I->sendGET($this->endpoint);
}
I have to test if the response contains only id
and name
key (not any other key)
I have found $I->seeResponseContainsJson()
, but it checks if JSON is present or not. It does not check if JSON response contains only specified keys.
Thanks.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire