Skip to content

Add support for testing JSON Responses #1

@mauricios

Description

@mauricios

Add support for testing JSON responses and validate JSON structures, see: https://codeception.com/docs/10-WebServices and https://codeception.com/docs/modules/REST#seeResponseMatchesJsonType

class PingCest
{
   public function testPing(AcceptanceTester $I)
   {
       $query = 'query{ping {response}}';
       $I->sendGraphQL($query);
       $I->seeResponseMatchesJsonType ([   
               'response' => 'string',
           ], '$.ping[*]'
       ]);
       $I->seeResponseContainsJson([
           'ping' => [
               'response' => 'pong',
           ]
       ]);  
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions