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