Boilerplate for Drupal/Behat tests. You may use this as a starting point for rolling your own Behat tests.
It is assumed that the following software is already installed:
- A recent version of Oracle Java (JRE OR JDK), with the
java
executable in yout PATH. - PHP 5.3.5+, with the
curl
,mb_string
andxml
extensions enabled and thephp
executable in your PATH. - Git
- The Firefox web-browser.
- Install Composer.
- Checkout the repo, install Behat via Composer.
git clone https://github.com/ucsf-drupal/drupal-behat-boilerplate.git
cd drupal-behat-boilerplate
composer install
- In
behat.yml
, set thebase_url
value to URL of the site that you want to test. - Define your features and scenarios. You may use
features/_template.feature
as a guiding example. - Back up your features by implementing step definitions in
features/bootstrap/FeatureContext.php
.
Run Behat with the default profile from the project's root directory.
cd <project>
bin/behat
-
Run Selenium as standalone
java -jar /path/to/your/selenium-server-standalone.jar
-
Run Behat tests with the "browser" profile
cd <project> bin/behat -p browser
-
Why am I getting "PHP Fatal error: Class 'DOMDocument' not found..."?
Make sure your
php-xml
PHP extension is installed or up-to-date.sudo yum install php-xml
-
Why am I getting "PHP Fatal error: Call to undefined function Behat\Behat\DependencyInjection\mb_internal_encoding()..."?
Make sure you have installed the
php-mbstring
PHP extension.sudo yum install php-mbstring
-
Why I am not getting colored output from behat tests?
Behat is probably not picking up the type of terminal you're using. Forcing it to run in ANSI mode will probably fix it.
bin/behat --ansi