Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I'm going though default settings (https://drupal.org/project/drupalextension) and I can't run basic black-box feature
LOCALHOST:/var/www/sandbox/drupal/behat $ bin/behat -v
@api
Feature: DrupalContext
In order to prove the Drupal context is working properly
As a developer
I need to use the step definitions of this context
[InvalidArgumentException]
Driver "drush" is not registered.
Exception trace:
() at /var/www/sandbox/drupal/behat/vendor/drupal/drupal-extension/src/Drupal/Drupal.php:85
Drupal\Drupal->setDefaultDriverName() at /var/www/sandbox/drupal/behat/vendor/drupal/drupal-extension/src/Drupal/DrupalExtension/Context/Initializer/DrupalAwareInitializer.php:121
Drupal\DrupalExtension\Context\Initializer\DrupalAwareInitializer->prepareDefaultDrupalDriver() at n/a:n/a
call_user_func() at /var/www/sandbox/drupal/behat/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:164
Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at /var/www/sandbox/drupal/behat/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php:53
Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at /var/www/sandbox/drupal/behat/vendor/behat/behat/src/Behat/Behat/Tester/ScenarioTester.php:69
Behat\Behat\Tester\ScenarioTester->visit() at /var/www/sandbox/drupal/behat/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
Behat\Gherkin\Node\AbstractNode->accept() at /var/www/sandbox/drupal/behat/vendor/behat/behat/src/Behat/Behat/Tester/FeatureTester.php:88
Behat\Behat\Tester\FeatureTester->visit() at /var/www/sandbox/drupal/behat/vendor/behat/gherkin/src/Behat/Gherkin/Node/AbstractNode.php:42
Behat\Gherkin\Node\AbstractNode->accept() at /var/www/sandbox/drupal/behat/vendor/behat/behat/src/Behat/Behat/Console/Command/BehatCommand.php:150
Behat\Behat\Console\Command\BehatCommand->runFeatures() at /var/www/sandbox/drupal/behat/vendor/behat/behat/src/Behat/Behat/Console/Command/BehatCommand.php:128
Behat\Behat\Console\Command\BehatCommand->execute() at /var/www/sandbox/drupal/behat/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
Symfony\Component\Console\Command\Command->run() at /var/www/sandbox/drupal/behat/vendor/symfony/console/Symfony/Component/Console/Application.php:897
Symfony\Component\Console\Application->doRunCommand() at /var/www/sandbox/drupal/behat/vendor/symfony/console/Symfony/Component/Console/Application.php:191
Symfony\Component\Console\Application->doRun() at /var/www/sandbox/drupal/behat/vendor/behat/behat/src/Behat/Behat/Console/BehatApplication.php:68
Behat\Behat\Console\BehatApplication->doRun() at /var/www/sandbox/drupal/behat/vendor/symfony/console/Symfony/Component/Console/Application.php:121
Symfony\Component\Console\Application->run() at /var/www/sandbox/drupal/behat/vendor/behat/behat/bin/behat:32
Comments
Comment #1
gregglesI think I've had this problem when I didn't yet run "composer install" and/or didn't run behat --init.
Can you also post the contents of your composer.json and behat.yml file?
Comment #2
jhedstromComment #3
eliza411 CreditAttribution: eliza411 commentedClosing after 1 year with no follow-up. Feel free to re-open with the requested information if this is still relevant.
Comment #4
joelpittetI'm seeing this as well.
Composer is installed, composer.json is installed, behat --init has been run.
/Users/joel/Sites/site/behat/behat.yml
/opt/drupalextension/composer.json
Comment #5
joelpittetWas missing
Comment #6
mark.labrecqueThis fixed it for me! Thanks @joelpittet
Comment #7
gregglesRegarding #5/#6: I think it's optional to add the
api_driver: 'drush'
piece, but at least setting an alias that will work from the directory where the behat tests are run. Setting the api_driver will set that for all api tests and the drush driver is not as fast/feature-rich as the Drupal API driver. I solved this problem today by creating a working drush alias and then modifying my behat.yml like so: