1 Contributed Module Subcontexts
2 ==============================
4 Although not yet a wide-spread practice, the Drupal Extension to Behat and Mink
5 makes it easy for maintainers to include custom step definitions in their
9 Discovering SubContexts
10 -----------------------
12 In order to use contributed step definitions, define the search path in the
15 // sites/default/behat-tests/behat.yml
17 .. literalinclude:: _static/snippets/behat-sub.yml
20 :emphasize-lines: 8-9,25-26
22 The Drupal Extension will search recursively within the directory or
23 directories specified to discover and load any file ending in `.behat.inc`. This
24 system, although created with Drupal contrib projects in mind, searches where
25 it's pointed, so you can also use it for your own subcontexts, a strategy you
26 might employ to re-use step definitions particular to your shop or company's
27 development patterns. The `paths` key allows running tests located in features
28 within the `features` directory of a contributed/custom module.
32 Autoloading can be disabled in the behat.yml file temporarily with the
35 .. literalinclude:: _static/snippets/behat-auto.yml
43 <http://docs.behat.org/guides/4.context.html#using-subcontexts>`_ are no longer
44 supported in version 3. The Drupal Extension, however, continues to support
45 saving module-specific contexts in a file ending with `.behat.inc`
47 Just like functions, preface the filename with the project's machine name to prevent namespace collisions.
49 .. literalinclude:: _static/snippets/subcontext.inc