I hit on a bug when upgrading from Codeception 1.8.x to Codeception 2.1.3.
I entirely skipped the 2.0.* branch of Codeception, not through any other reason than 1.8.x was working fine for me.
During a recent site update, I decided it would be a good time to update the Codeception tests suite to the latest release.
Unfortunately, the upgrade did not go smoothly.
crvuser@crv-dev:/var/www/codereview.dev$ php vendor/codeception/codeception/codecept run acceptance SignUpCest.php --debug Codeception PHP Testing Framework v2.1.3 Powered by PHPUnit 4.8.12 by Sebastian Bergmann and contributors. Segmentation fault
I constantly hit this issue, but only with the Acceptance test suite. The unit tests passed absolutely fine.
I even got very specific with my versions inside composer.json
:
"require-dev": { "phpunit/phpunit": "4.8.12", "codeception/codeception": "2.1.3", "facebook/webdriver": "1.0.2" },
(some other stuff removed for brevity)
But still I hit the Segmentation Fault error every single time I ran the acceptance tests.
My Fix
Alas, my fix isn’t great. But it has worked.
I figured with the major version changing, chances are something went pear shaped internally.
My test suite isn’t hugely customised, but it did have a bit of extra stuff sprinkled in here and there. Something in there may very well have caused it.
Anyway, after much debugging (difficult as it happens), I gave up and did the following:
- Renamed the
tests/
dir totests_bak
- Renamed
codeception.yml
dir tocodeception_bak.yml
- Ran
php vendor/codeception/codeception/codecept bootstrap
And then, piece by piece, copied all my tests and config back across to the respective files.
Don’t copy / overwrite.
Instead, copy the relevant bits from the files – especially the configs. Things have changed.
Also, I found it easiest to re-run the test suite for every individual file I copied over. One by one at first, but as I copied in more of the directories, I ended up getting quicker and quicker.
Not the most elegant of solutions, but the test suite is back to working.
Interested in learning more about Codeception? I have a full course on the site.
Ahh, but it returns…
I wanted to add something extra to this.
I hit this issue again in Codeception 2.1.3.
From what I can discern, the size of your test database (e.g. dump.sql ) seems to have some impact on causing the Segmentation Fault issue.
I found that by removing data from my tables – generally less than 50 rows per table – the Segmentation Fault issue went away.
Frustrating that I don’t know the exact cause of it, but if in doubt, strip it out.