Answer the question
In order to leave comments, you need to log in
Where to get access_token when testing RestApi with Codeception?
I came across such a thing, all my api is closed for unauthorized users, so you must first get a token.
That is, before all the tests, you need to execute the code, get the token, put it in the amBearerAuthenticated method and run all the tests.
As I fields all tests should be executed in any order and not depend on each other.
I can get the token in every test in the _before method:
class GroupResponseCest
{
public function _before(ApiTester $I)
{
// получить токен
$I->amBearerAuthenticated($token);
}
public function all(ApiTester $I)
{
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question