1 Stand-alone installation
2 ========================
4 A stand-alone installation is recommended when you want your tests and testing
5 environment to be portable, from local development to CI server, to client
6 infrastructure. It also makes documentation consistent and reliable.
8 1. Create a folder for your BDD tests::
13 All the commands that follow are written to install from the root of your
16 2. Install Composer, a php package manager::
18 curl -s https://getcomposer.org/installer | php
20 3. Create a composer.json file to tell Composer what to install. To do that,
21 paste the following code into your editor and save as composer.json. The
22 Drupal Extension requires Behat, Mink, and the Mink Extension. They will all
23 be set up because they're dependencies of the Drupal Extension, so you don't
24 have to specify them directly in the composer.json file:
26 .. literalinclude:: _static/snippets/composer.json
30 For Drupal 8, you'll need to specify the correct version of Guzzle:
32 .. literalinclude:: _static/snippets/composer.json.d8
37 4. Run the following command to install the Drupal Extension and all those
38 dependencies. This takes a while before you start to see output::
40 php composer.phar install
42 5. Configure your testing environment by creating a file called behat.yml with
43 the following. Be sure that you point the base_url at the web site YOU intend
44 to test. Do not include a trailing slash:
46 .. literalinclude:: _static/snippets/behat-1.yml
50 6. Initialize behat. This creates the features folder with some basic things to
51 get you started, including your own FeatureContext.php file::
55 7. This will generate a FeatureContext.php file that looks like:
57 .. literalinclude:: _static/snippets/FeatureContext.php.inc
62 This FeatureContext.php will be aware of both the Drupal Extension
63 and the Mink Extension, so you'll be able to take advantage of their
64 drivers add your own custom step definitions as well.
66 8. To ensure everything is set up appropriately, type::
70 You'll see a list of steps like the following, but longer, if you've
71 installed everything successfully:
74 .. code-block:: gherkin
77 default | Given I am an anonymous user
78 default | Given I am not logged in
79 default | Given I am logged in as a user with the :role role(s)
80 default | Given I am logged in as :name