Behat Drupal Extension Stand-alone installation

Profile picture for user devraj

There are 2 types of installation described by Drupal Extension official website. First one is Stand-alone installation. A stand-alone installation is recommended when you want your tests and testing environment to be portable, from local development to CI server, to client infrastructure. It also makes documentation consistent and reliable.

Step 1: Create folder for your BDD tests:

$ mkdir projectfolder
$ cd projectfolder

Step 2: Install Composer, PHP package manager:

$ curl -s | php

Step 3: Create a composer.json file to tell Composer what to install. To do that, paste the following code into your editor and save as composer.json. The Drupal Extension requires Behat, Mink, and the Mink Extension. They will all be set up because they’re dependencies of the Drupal Extension, so you don’t have to specify them directly in the composer.json file:

  "require": {
    "drupal/drupal-extension": "^3.2"
  "config": {
    "bin-dir": "bin/"

Step 4: Run the following command to install the Drupal Extension and all those dependencies. This takes a while before you start to see output:

$ php composer.phar install

Step 5: Test that your installation work by typing below command:

$ bin/behat --help

 If you were successful, you’ll see the help output.