A step by step guide to installing Behat 3 for Windows.
Requirements:
Note: if you already have Composer installed make sure to update it before moving on to the next step.
Step 1
Create a new directory for Behat 3.
Example:
C:\behat3
Now we need a composer.json file in that directory.
composer.json
{"require": {"drupal/drupal-extension":"~3.0","guzzlehttp/guzzle":"^6.0@dev"},"config": {"bin-dir":"bin/"}}
Step 2
Now we need to install Behat using Composer.
In your Command Prompt run:
php composer.phar install
Notes:
- If you have previously installed Behat v2.5.5 then you need to remove it from system path.
- If you have Behat 2.5.5 installed you will need to run Behat using the full path.
Example:
Behat 3:
C:\behat3\vendor\bin\behat
Behat 2:
C:\behat\bin\behat
Step 3
In your Command Prompt....
Create a test directory:
md C:\test
Now cd to that directory:
cd C:\test
Now run:
C:\behat3\vendor\bin\behat --init
This will provide us with the base file structure
Step 4
Create a behat.yml file in the test directory.
behat.yml
default:suites:default:contexts:- FeatureContext- Drupal\DrupalExtension\Context\DrupalContext- Drupal\DrupalExtension\Context\MinkContext- Drupal\DrupalExtension\Context\MessageContext- Drupal\DrupalExtension\Context\DrushContextextensions:Behat\MinkExtension:goutte: ~selenium2: ~base_url: http://seven.lDrupal\DrupalExtension:blackbox: ~
Step 5
Go to Command Prompt and run:
C:\behat3\vendor\bin\behat --dl
This will print a list of Behat functions available.
Step 6
Get familiar with Behat by reading the online documentation, or get completely up to speed with our Quality Assurance training course.