I wanted to automate the functional codeception testing in yii2,I am able to test the login API using the following code
use tests\codeception\backend\FunctionalTester;
$I = new FunctionalTester($scenario);
$I->wantTo('Check when authenticated');
$I->sendPOST('/login', ['password' => '11111111', 'email'=>'check@check.com']);
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContains('"result"');
$I->seeResponseContains('"message"');
$I->haveHttpHeader('Accept','application/json');
$I->seeResponseContains('"message":"OK"');
In Login API I return the auth_token which can be used for further processing,So Where do I save the result of login API and use it for testing the further API's
Aucun commentaire:
Enregistrer un commentaire