Setup Behat

The PIM comes with a set of Behat scenarios:

These scenarios allow to:

  • describe the PIM features and the expected behavior for a real user
  • ensure there is no regression from functional point of view during the development cycle

Install Behat

You can install Behat dependencies with composer (on pim-community-dev).

$ php composer.phar install --dev

Install Selenium Server

Download Selenium server 2.38 here.

Install Firefox 26.0

In order to use Selenium RC, you must actually install firefox 26.0.

Create a VirtualHost

To be sure to test in an environment as close as possible to a production environment, we need to define a specific VirtualHost with production RewriteRule (some limitations of Oro Platform does not allow to have production environment with the boostrap file included in the URL):

<VirtualHost *:80>
    ServerName pim-behat.local

    RewriteEngine On

    DocumentRoot /home/akeneo/pim/web
    <Directory /home/akeneo/pim/web>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

    RewriteRule ^(.*) %{DOCUMENT_ROOT}/app_behat.php [QSA,L]

    ErrorLog ${APACHE_LOG_DIR}/akeneo-pim-behat_error.log

    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/akeneo-pim-behat_access.log combined



Do not forget to update your /etc/hosts file to include the VirtualHost hostname:   pim-behat.local

Configure Behat

Setup the test environment, begin by copy and update the app/config/parameters_test.yml to use the minimal dataset and a dedicated database :

database_name:     pim_behat
installer_data:    PimInstallerBundle:minimal

Then install the database for this environment.

$ php app/console pim:install --env=behat --force

Then copy behat.yml.dist to behat.yml, edit base_url parameter to match your host:

            base_url: http://pim-behat.local/
            base_url: http://pim-behat.local/

Run features

You can now launch Selenium by issuing the following command:

$ java -jar selenium-server-standalone-2.33.0.jar

All the feature tests can be run by issuing the following command:

> ~/git/pim-community-dev$ ./bin/behat

You can also define which feature to run :

> ~/git/pim-community-dev$ ./bin/behat features/product/edit_product.feature

More details and options are available on