4 Many tests require that a user logs into the site. With the blackbox driver,
5 all user creation and login would have to take place via the user interface,
6 which quickly becomes tedious and time consuming. You can use the Drush driver
7 to add users, reset passwords, and log in by following the steps below, again,
8 without having to write custom PHP. You can also do this with the Drupal API
9 driver. The main advantage of the Drush driver is that it can work when your
10 tests run on a different server than the site being tested.
15 See the `Drush project page <https://drupal.org/project/drush>`_ for
16 installation directions.
18 Install the Behat Drush Endpoint
19 --------------------------------
21 The Behat Drush Endpoint is a Drush-based service that the Drush Driver uses in order to create content on the Drupal site being tested. See the `Behat Drush Endpoint project page <https://github.com/drush-ops/behat-drush-endpoint>`_ for instructions on how to install it with your Drupal site.
23 Point Drush at your Drupal site
24 -------------------------------
26 Drupal Alias (For local or remote sites)
27 ++++++++++++++++++++++++++++++++++++++++
29 You'll need ssh-key access to a remote server to use Drush. If Drush and Drush
30 aliases are new to you, see the `Drush site <http://drush.ws/help>`_ for
31 `detailed examples <http://drush.ws/examples/example.aliases.drushrc.php>`_
33 The alias for our example looks like:
35 .. literalinclude:: _static/snippets/aliases.drushrc.php
39 Path to Drupal (local sites only)
40 +++++++++++++++++++++++++++++++++
42 If you'll only be running drush commands to access a site on the same machine,
43 you can specify the path to your Drupal root:
48 Drupal\DrupalExtension:
51 root: /my/path/to/drupal
54 Enable the Drush driver
55 -----------------------
57 In the behat.yml file:
59 .. literalinclude:: _static/snippets/behat-drush.yml
62 :emphasize-lines: 15-17
64 .. note:: Line 15 isn't strictly necessary for the Drush driver, which is the
67 Calling the Drush driver
68 ------------------------
70 Untagged tests use the blackbox driver. To invoke the Drush driver, tag the
73 .. literalinclude:: _static/snippets/apitag.feature
78 If you try to run a test without that tag, it will fail.
83 .. literalinclude:: _static/snippets/apitag.output
86 :emphasize-lines: 10-12
89 The Drush driver gives you access to all the blackbox steps, plus those used in
90 each of the following examples:
92 .. literalinclude:: _static/snippets/drush.feature
96 If the Behat Drush Endpoint is installed on the Drupal site being tested, then you will also have access to all of the examples shown for the Drupal API driver.