Getting started with behat – Installation or Setup

Behat/Mink

Install using composer (for other methods check ) behat.org
If you using linux, please go sure that you have installed php-curl (normal curl installation won’t work)

Linux

sudo apt-get install php5-curl

If you are using Windows, make sure you have PHP, Curl and Git installed.
You can find those under following links:

Your composer.json would contain the following:

behat – composer.json

{
  "require": {
    "behat/behat": "dev-master",
    "behat/mink": "dev-master",
    "behat/mink-extension": "dev-master",
    "behat/mink-selenium2-driver": "dev-master",
    "phpunit/php-code-coverage": "dev-master",
    "phpunit/phpunit-mock-objects": "dev-master",
    "phpunit/phpunit": "dev-master"
  },
  "minimum-stability": "dev",
  "config": {
    "bin-dir": "bin/"
  }
}

(when saving the composer.json file in Windows, you need to choose "All files" as Filetype and "ANSI" coding)

Afterwards execute the following commands:

$ curl http://getcomposer.org/installer | php
$ php composer.phar install

After this Behat, Mink and Behat-Mink extension are installed,
To execute behat

execute behat

$ bin/behat

To activate the Behat-Mink Extension use: behat.yml
create a file "behat.yml" with the following content

behat.yml

default:
  suites:
    default:
      paths:
        features: %paths.base%/features/
        bootstrap: %paths.base%/features/bootstrap/
      contexts: 
        - FeatureContext
  extensions:
    Behat\MinkExtension:
      base_url: 'http://www.startTestUrl.de'
      selenium2:
        browser: firefox
        wd_host: "http://localhost:4444/wd/hub"

This file will be in the same directory that contains bin directory and link to behat.
Also note that in the yml file, do not use tabs for indentation. use spaces.
To get a list of commands available in behat-mink, use

$ bin/behat -di

Make behat part of your system

Linux

Go to your Homedirectory and do the following:

$ sudo vi .bashrc

And add this lines at the end of the directory

export BEHAT_HOME=/home/*user*/path/to/behat
export PATH=$BEHAT_HOME/bin:$PATH

Restart the console or type "source .bashrc"

Windows

Go over the Systemsettings and add the Path of behat/bin to the environment-variables

Other Drivers
Over drivers like Selenium, phantomjs, goutte, etc. must be installed too.

if you want to reproduce, please indicate the source:
Getting started with behat – Installation or Setup - CodeDay