Hello everyone!

We have been investing plenty of personal time and energy for many years to share our knowledge with you all. However, we now need your help to keep this blog running. All you have to do is just click one of the adverts on the site, otherwise it will sadly be taken down due to hosting etc. costs. Thank you.

You can create more than one bundle in your application and have their own behat tests. In such cases we use --suite flag to run tests. In this example we're going to have set of tests under a bundle and another set under root folder.


Structure


inanzzz
...
features
Context
CommonContext
FeatureContext
CountryContext
Tests.feature
...
src
Inanzzz
ApplicationBundle
...
Features
Context
CommonContext
FeatureContext
CountryContext
Tests.feature
...
...
behat.yml
...

Behat.yml


Critical point here is autoload and bundle properties.


default:
autoload:
- %paths.base%
extensions:
BehatSymfony2Extension: ~
BehatMinkExtension:
base_url: http://inanzzz.dev:8082/app_test.php
sessions:
symfony2:
symfony2: ~
suites:
app:
type: symfony_bundle
bundle: InanzzzApplicationBundle
mink_session: symfony2
contexts:
- InanzzzApplicationBundle\Features\Context\FeatureContext
- InanzzzApplicationBundle\Features\Context\CommonContext
- InanzzzApplicationBundle\Features\Context\CountryContext

root:
mink_session: symfony2
contexts:
- features\Context\FeatureContext
- features\Context\CommonContext
- features\Context\CountryContext

Tests


$ vendor/bin/behat --suite=app

$ vendor/bin/behat --suite=root