Skip to content

Latest commit

 

History

History
68 lines (46 loc) · 4.02 KB

running_tests.md

File metadata and controls

68 lines (46 loc) · 4.02 KB

Running tests

Configuration

In order to use ibexa/behat you need to use behat Symfony environment (which is defined in Ibexa by default). It is also recommended to run in enabled debug mode, which gives you more detailed browser screenshots in case of failure.

The standard behat configuration file is behat_ibexa_oss.yaml, located in ibexa/behat directory. There you can:

  • in the Behat\MinkExtension section:
    • set the URL of your website for browser testing (base_url parameter)
    • set driver configuration (for example wd_host for Selenium Server)
    • see MinkExtension documentation for more information
  • in the Bex\Behat\ScreenshotExtension section:

Behat profiles and suites are not defined in this file, but imported from files specified at the top.

Running browser tests

If you want to run browser tests you need to have Selenium Server runnning. One way of doing this is running our Docker stack, which has built-in support for it: see Ibexa Docker blueprints documentation for more information.

Another way is to use the Selenium Server Docker container and setting it up manually. Look at manifest.json file for the currently used version.

It can be set up using examples from docker-selenium.

Example for Chrome would be: docker run -d -p 4444:4444 -p 7900:7900 --shm-size="2g" selenium/standalone-chrome:latest

Where:

  • 4444 is the port where Selenium Server will be accessible
  • 5900 is the port where the VNC client is accessible (to preview running tests)
  • shm-size is related to Chrome containers requiring more memory (see Selenium container configuration)

After the container is set up correctly you need to adjust the configuration of selenium2 driver in behat_ibexa_oss.yaml file

Running tests

Running standard Behat tests

Ibexa/behat comes with a wrapper for the standard Behat runner: ibexabehat to make running tests in parallel easier.

Use:

# standard Behat runner
bin/ibexabehat --mode=standard --profile=profileName --tags=exampleTag
bin/ibexabehat -m=standard -p=profileName -s=suiteName -t=exampleTag
# parallel Behat runner
bin/ibexabehat -m=parallel -p=profileName -s=suiteName
bin/ibexabehat --profile=profileName --suite=suiteName

Running Behat feature files in parallel (on the available number of CPUs) is the default option when mode is not specified. See the script documentation for more examples.

Existing test profiles and suites

By convention profiles and suites are defined in the behat_suites.yml file in each bundle, if they exist. See Behat suites and AdminUI suites for examples.

In order to run them, execute:

  • bin/ibexabehat --profile=behat --suite=examples (behat usage examples)
  • bin/ibexabehat --profile=adminui --suite=adminui (all AdminUI tests)

Previewing browser tests

The Selenium Server container comes with VNC server that allows you to preview browser tests when they're running. It runs on port 5900 and is protected by password secret.

See Docker Selenium documentation on debugging for more details.