Types of Drupal Extension Drivers

Profile picture for user devraj

The Drupal Extension provides drivers for interacting with your site which are compatible with Drupal 6+. Each driver has its own limitations.

Blackbox Driver: The blackbox driver assumes no privileged access to the site. All the actions will take place through the site’s user interface. Many tests require that a user logs into the site. With the blackbox driver, all user creation and login would have to take place via the user interface, which quickly becomes tedious and time consuming.

Drush Driver: The main advantage of the Drush driver is that it can work when your tests run on a different server than the site being tested.

Drupal API: The Drupal API Driver is the fastest and the most powerful of the three drivers. Its biggest limitation is that the tests must run on the same server as the Drupal site.

Here is the comparison between all:

FeatureBlackboxDrushDrupal API
Map RegionYesYesYes
Create UsersNoYesYes
Create NodesNoYes*Yes
Create VocabulariesNoYes*Yes
Create Taxonomy TermsNoYes*Yes
Run tests and site on different serversYesYesNo

Map Region: You can map region in yml and access and differentiate elements based on region.

I press "Search" in the "header" region
I click "About us" in the "footer" region

Users: You can create users and perform action using those users. You can use the Drush and Drupal API driver to add users, reset passwords, and log in without having to write custom PHP.

Nodes: You can create article, basic page etc.

Taxonomy and Vocabularies: Taxonomy is for categorizing content. Terms are grouped into vocabularies. For example, a vocabulary called "Fruit" would contain the terms "Apple" and "Banana".

[*] Requires that the Behat Drush Endpoint be installed on the Drupal site under test. The Behat Drush Endpoint is the remote component needed to work with the Behat Drupal Driver.