If you have decided to test with Behat and work on Windows OS, you will require some workaround as the official documentation is providing instructions for Unix/Mac installation only.

Maybe these instructions will be helpful to you.


(or WAMP respectively – here i will use XAMP)

  1. Download the XAMPP from the official site ttps://www.apachefriends.org/download.html
  2. Choose version – for this purpose, I have chosen version 5.6.23 / PHP 5.6.23
  3. Install XAMPP
    * Select all defaults, the default install path “C:\xampp”, you can choose differently but here I leave that as is.
  4. Setup the PHP by your requirements i will leave that up to you.


Quick intro: Composer is a dependency manager for PHP inspired by the Node.js for Javascript. For more to read about you have documentation on the official site Get Composer Link. If you have time I highly recommend to you dear reader to look into its documentation for more information.

Link for the Windows installer of composer is https://getcomposer.org/Composer-Setup.exe.
The installer will assum that you PHP is located in “C:\xampp\php” automatically. If you have changed that path, adjust it during the Composer installation as well.


1. Create or select a directory where you would like to install Behat e.g C:\behat

2. In the chosen Behat folder create a “composer.json” file which will be used by Composer to install the required dependencies

Type in the file the latest versions for behat and dependecies:

        "require": {       
        "behat/behat": "~3.0",      
        "behat/mink": "~1.7@dev",              
        "behat/mink-goutte-driver": "1.2.1",       
        "behat/mink-selenium2-driver": "~1.3.1" ,
        "behat/mink-extension": "*"
        "config": {       
            "bin-dir": "bin/"   

Little information about the dependencies from official sites:
Mink – is an open source browser controller/emulator for web applications, written in PHP 5.3. (http://mink.behat.org/en/latest/)
Goutte – is a screen scraping and web crawling library for PHP. req (https://github.com/FriendsOfPHP/Goutte)
MinkExtension – is an integration layer between Behat 3.0+ and Mink 1.5+ (https://github.com/Behat/MinkExtension)

These versions are used for this tutorial, for additional information please refer to the links above to choose you own desired versions.

3. Add to your Environment Variable Path section the path where you have installed behat e.g “C:\behat\bin” – for help how to do that please refer to this link: http://www.computerhope.com/issues/ch000549.htm

4. Open a Command Prompt and redirect to the desired path where will be behat installed e.g “C:\behat”

5. Once you are in the directory type in “composer install” (without the quotes), the Composer will download and install behat and dependencies added in the “composer.json”

6. Once it has finished download open a new Command Prompt to refresh the changes in the folders and type “behat –version” (without the quotes) to verify proper installation – it should respond with “behat version ” in this case it will be 3.1.0
in the same window type “behat –init” (without the quotes) and that will create “features” and “bootstrap” folders and a “FeatureContext.php” file in the “bootstrap” folder.

7. Save the “.yml” file in “C:\behat\”.

8. Save the “.feature” files in “C:\Behat\features”.

9. In the same command window, type: “behat –config behat.yml features\.feature” (without the quotes). The “” should be your desired name of the feature.

10. To run tests with Selenium download the latest selenium server standalone from http://www.seleniumhq.org/download/ and the respective browser drivers. This part won’t be covered in this tutorial.

With this setup, you should be able to create features and run them as usual tests.
Thank you for reading, if you have any comments or questions please write a comment.

Posted By Arnold Gergelj

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>