Coder Social home page Coder Social logo

drupal-behat-boilerplate's Introduction

About

Boilerplate for Drupal/Behat tests. You may use this as a starting point for rolling your own Behat tests.

Prerequisites

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 and xml extensions enabled and the php executable in your PATH.
  • Git
  • The Firefox web-browser.

Installation

  1. Install Composer.
  2. Checkout the repo, install Behat via Composer.
git clone https://github.com/ucsf-drupal/drupal-behat-boilerplate.git
cd drupal-behat-boilerplate
composer install

Getting Started

  • In behat.yml, set the base_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.

Running tests through the HTTP client

Run Behat with the default profile from the project's root directory.

cd <project>
bin/behat

Running tests in the web-browser

  1. Run Selenium as standalone

    java -jar /path/to/your/selenium-server-standalone.jar
    
  2. Run Behat tests with the "browser" profile

    cd <project>
    bin/behat -p browser
    

Troubleshooting

  • 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
    

Learn More

drupal-behat-boilerplate's People

Contributors

stopfstedt avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.