Search code examples
laravelcodeceptionacceptance-testing

Codeception CEST acceptanse tests, how to rerun __bootstrap code before each test?


I am using Codeception for acceptance testing my code. What I need is to rerun the migrations and seeding (which I have specified in _bootstrap file) before each test. How can I do that?


Solution

  • Move that code to _before method of _support\Helper\Acceptance.php if you want to run it before all acceptance tests.

    http://codeception.com/docs/06-ModulesAndHelpers#Hooks

    namespace Helper;
    
    class Acceptance extends \Codeception\Module
    {
        public function _before(\Codeception\TestInterface $test) {
        {
            // migrations
            // seeding
        }
    }