Behat bundle for help testing eZ Bundles and projects

Installs: 354 016

Dependents: 17

Suggesters: 0

Stars: 31

Watchers: 19

Forks: 13


Build Status Downloads Latest stable License

Behat Bundle brings the Behavior Driven Development (as known as BDD) into the eZ Publish.

Using latest Behat 3 and defining sentences with Turnip language, making scenarios it is easier than ever!

Important - Behat Bundle is still improving (a work in progress) so it's possible that deep changes may occur

How to install

BehatBundle should be installed by default (unless --no-dev was used in composer). To verity this, jump to How to run tests If it is not installed, you can:

  1. Get Behat bundle:
  • Through composer, run on console:
    • $ php composer.phar require "ezsystems/behatbundle": "*"
  • Through git clone:
    • $ git clone https://github.com/ezsystems/BehatBundle vendor/ezsystems/behatbundle/EzSystems/BehatBundle
  • Download from GitHub:
    • download BehatBundle and unzip it in <ezpublish-root>/vendor/ezsystems/behatbundle/EzSystems/BehatBundle
  1. Add Behat Bundle to load list (under dev)
  • Edit <ezpublish-root>/ezpublish/EzPublishKernel.php
  • Add new EzSystems\BehatBundle\EzSystemsBehatBundle(), to $bundles in EzPublishKernel::registerBundles()


  • behaviour tests should be done in production environment, since the scenarios should reflect end user interaction with the system.

Browser testing

When javascript interacion isn't needed to test content/browser behavior, Goutte is used (through MinkGoutteDriver), which is much faster than using a real browser.

However, when a real browser is needed, (because a given scenario requires the use of javascript, for example), Goutte is not sufficient. In this case, Sahi or Selenium2 must be used (again through each driver MinkSahiDriver and MinkSelenium2Driver).

So either one of these must be installed and running (Sahi is the one enabled by default), the configured browser is also required Firefox is the default). These settings can be easily changed on behat.yml at:

            javascript_session: sahi
            browser_name: firefox

How to run tests

Simply run:

  • $ php bin/behat --profile <profile> [--suite <suite>]

Defined profiles (and suites):

  • setupWizard
    • demoContent - make a Demo with content installation
      • demoContentNonUniqueDB - in cases where more than 1 database system is installed on machine
      • demoClean - make a clean installation of Demo
        • demoCleanNonUniqueDB - same asdemoContentNonUniqueDB
  • demo:
    • content - asserts the demo content is correct
  • rest:
    • fullJson - runs all tests with JSON body type and Buzz driver
    • fullXml - same has fullJson but with XML body type
      • guzzle - runs all tests with JSON body type but using Guzzle driver


  • setupWizard profile can only be run when installation is not done and it can't be repeated
  • setupWizard has the database definitions set on the feature files, so you need to have the dabase system, database and user created (take a look at demo.feature)

Known issues

  • SetupWizard profile needs PROD environment defined (otherwise it will find duplicate html elements)