Behat installation and paths

Events happening in the community are now at Drupal community events on www.drupal.org.
moonray's picture

I've been reading up on Behat and how to use it with Drupal. Every writeup seems to make assumptions about where to install Behat and put its configuration files, but nowhere is it definitively stated.

A. From what I gather there are 2 ways to install Behat:
1. Locally (with the binary in [drupal_root]/bin)
2. Globally (one system-wide installation of Behat in /usr/local/bin)

The first seems to be the preferred method (though never definitively stated). Aside from possible version conflicts between projects, are there downsides to a global Behat install?

B. Then, where do you put behat.yaml?
1. In the drupal site's root
2. In the [drupal_root]/sites/[site_name] directory
3. Another option

C. Where is the best place for the Features directory?
1. [drupal_root]/sites/all
2. Somewhere else

If you drop it in [drupal_root]/sites/all you can't reuse them for other Drupal sites (I have multiple Drupal installations due to working on various projects for different clients).

It's be nice to get this defined.

Comments

Features path

moonray's picture

Additionally, where is the best place for the Features directory?
If you drop it in [drupal_root]/sites/all you can't reuse them for other Drupal sites (I have multiple Drupal installations due to working on various projects for different clients).

tunic's picture

I've explained my installation here:
https://groups.drupal.org/node/303163#comment-935118

I prefer system-wide installation because I don't like extra files in Drupal filesystem. As all projects are Drupal sites I don't expect compatibility problems because they are pretty similar. DrupalExtension works with at least D6 and D7.

I prefer to put behat.yml in [drupal_root]/sites/default because behat.yml may have custom settings for each site (think in dev, stage, prod sites, where some configuration may differ). Usually sites/default is not under git control and is only set up once when project environment is configured.

I prefer to put features inside [drupal_root]/sites/all because tests must be the same for all sites for same project (behat.yml can be used for environment customization). Usually tests are very specific for each project, so it's hard to reuse them (you can have Behat tests for individual modules, but I think that is another scenario, my set up is for integration/aceptance tests).

If you are using a multisite set up things may be different.

I also have to say that I'm a beginner using behat and Drupal so I may have not consider all things.

Multiple Features directories?

moonray's picture

Is it possible to have multiple Features directories?
That way you could have a general set of tests that you reuse on all your sites, and site specific test.

Yes, it seems so

tunic's picture

From behat doc:

The first configuration block is paths. Parameters under this configuration block tell Behat where to find your feature and bootstrap files:

# behat.yml
default:
paths:
features: features
bootstrap: %behat.paths.features%/bootstrap

The features parameter defines where Behat will look for your *.feature files. The given directory will be scanned recursivly.

I think you only have to put your tests in different directories inside features directory.

http://docs.behat.org/guides/7.config.html#paths

Behat

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: