Testing and QA

Problem running Behat tests after running PHPUnit

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Ramindu Deshapriya
Problem running Behat tests after running PHPUnit


I have an instance of Moodle cloned from master and I was writing and running Behat tests on it without any problems until as recently as late May. 

However, the past couple of weeks I've been writing and running PHPUnit tests, and set up my configuration for that on the same instance. These are are also running fine. 

When I attempted to initialize my Behat tests today with php admin/tool/behat/cli/init.php, I get the following error message: 

PHP Warning:  require(Moodle\BehatExtension\Extension): failed to open stream: No such file or directory in /var/www/html/moodle/vendor/behat/behat/src/Behat/Behat/Extension/ExtensionManager.php on line 112
PHP Fatal error:  require(): Failed opening required 'Moodle\BehatExtension\Extension' (include_path='/var/www/html/moodle/vendor/phpunit/php-text-template:/var/www/html/moodle/vendor/phpunit/phpunit-mock-objects:/var/www/html/moodle/vendor/phpunit/php-timer:/var/www/html/moodle/vendor/phpunit/php-token-stream:/var/www/html/moodle/vendor/phpunit/php-code-coverage:/var/www/html/moodle/vendor/phpunit/phpunit:/var/www/html/moodle/vendor/symfony/yaml:/var/www/html/moodle/vendor/phpunit/dbunit:/var/www/html/moodle/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear') in /var/www/html/moodle/vendor/behat/behat/src/Behat/Behat/Extension/ExtensionManager.php on line 112
Error: Error running behat CLI command. Try running "vendor/bin/behat --help" manually from CLI to find out more about the problem.
Is this an issue caused by attempting run PHPUnit and Behat on the same instance? My PHPUnit tests are still running fine. None of the Behat configurations in config.php have been changed too. 

Thanks for your help in advance.

Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: Problem running Behat tests after running PHPUnit
Group Core developersGroup Documentation writersGroup Particularly helpful MoodlersGroup Plugin developers

There should be not problem running PHPunit and Behat on the same instance.

I have not yet upgraded to this week's weekly. Is anyone else seeing this issue?

Average of ratings: -
Rajesh Taneja
Re: Problem running Behat tests after running PHPUnit

Hello Ramindu,

Is this still an issue, can you please try drop and re-initialise unit test environment.

Average of ratings: -