Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Codeception 1.8 or 2.0x?

I am trying to implement codeception into my palcon project. I'm relatively new to phalcon (since July) and totally new to testing (since 4 days ago, never did any formal tests of any kind before) so I may be seriously off track. But I have tried to implement the simplest of tests, following the tutorials for phalcon1/codeception 1.8 with a phalcon-simple project: just testing if the front page contains the word "Congratulations".

I can make this test pass for both acceptance and functional with 1.8 but I have found no way to make it pass for functional with 2.0.x. Further: 1.8 gives me meaningfull errors while 2.0x doesn't - which helped me solve a trivial issue I first fought with for two days in codecept 2.0.

So should I stay with codeception 1.8 or are there some tutorials/instructions that I need to go through to work with codecept 2.0?


Congratulations!!! It is great to see that you are moving down the right track, i.e. testing your code using a tool like Codeception. I can assure you it will save you hours and hours of needless bug hunting in the future.

I run my tests with Codeception 1.8 and recently I have moved to Codeception 2.0. For my tests there has been no change really. All I had to do is:

php codecept.php self-update

and after that was completed (it updated Codeception to 2.0) I had to rebuild the base classes i.e. helpers such CodeGuy, DbGuy etc.

php codecept.php build

That should do it.

Just a FYI, for testing issues including those of Codeception, you can always check this forum out

edited Oct '14

Thanks. I upgraded (using composer), replacing 1.8 with this:

"codeception/codeception": "2.0.*@dev"

My tests still passes.

Funny thing is that if I update v1.8 it works but if I install directly v2.0x it doesn't. When I started out with v2.0x. It initially didn't work at all. Then I changed the class names from AcceptanceTester and FunctionalTester to WebGuy and TestGuy respectively, after which it did work some but the functional test still failed.

I suspect there are some more things to make the phalcon module work fully with v2.0.

EDIT: Did a complete reinstall (with composer). Codeception is now at 2.0.7, everything works (apparently) perfect. Don't know if was doing something wrong before or the update fixed things.