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)

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?

Thank you

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 ApiTester? Because I can't figure out what else could possibly be wrong.


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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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