Within test how to get response html or json in a string

The code below for example does verification of the schema.


But I need access to the raw response and cannot find a way to get this response from available method.

namespace frontend\tests\Api;

use frontend\tests\ApiTester;
use Codeception\Util\HttpCode;

class UserCest
    public function _before(ApiTester $I)

    // tests
    public function tryToTest(ApiTester $I)

    public function RegisterUserStep1(ApiTester $I)

This should be possible with:

$responseContent = $I->grabResponse();

See also API Testing - Codeception Docs

1 Like