1

I've tried to use this style: https://codeception.com/docs/07-AdvancedUsage#Example-Annotation

My example test case is this:

/**
 * @example { "groupid": "16789507", "partnerccdid": "31003704" }
*/
public function getPartnerCcdIdWithGroupId(ApiTester $I)
{
    $I->see($example["groupid"]);
}  

When I run this using this command: php codecept.phar run -vvv I only get the following error:

[PHPUnit\Framework\Exception] Undefined variable: example

According to https://jsonformatter.curiousconcept.com/, it's a valid JSON. I'm using it the way they explain in the official documentation, all my strings are enclosed in double quotes.

What am I missing here?

EDIT: I'm actually trying to use SOAP module and test an API. Just a thought crossed my mind.

Is this annotation style allowed with the module and API Tester? Because I can't figure out what else could possibly be wrong.

1 Answer 1

1

You do not pass in the $example as described in the documentation:

public function getPartnerCcdIdWithGroupId(ApiTester $I, \Codeception\Example $example)
1
  • :D of course. Well, I just didn't see that. Thank you.
    – pavelsaman
    Aug 27, 2019 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.