I have tried Behat 2.5 in the past and had no issues setting it up, but now I just downloaded Behat 3 and I am having some difficulties trying to set it up.
My problem is that, after a fresh install, if I create a behat.yml file I cannot seem to be able to define where the FeatureContext file is and I cannot run any tests.
My composer.json is like follows:
{
"require-dev": {
"behat/behat": "~3.0.4",
"sensiolabs/behat-page-object-extension": "2.0.*@dev"
},
"require": {
"behat/mink": "1.6.*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium2-driver": "*"
}
}
My project folders are structured the following way:
behat/
bootstrap/
FeatureContext.php
config/
behat.yml
features/
CheckHome.feature
vendor/
composer.json
composer.lock
And my behat.yml file:
default:
autoload:
'': %paths.base%/../bootstrap
suites:
default:
paths:
- %paths.base%/../features
contexts:
- FeatureContext
And when I try to run the scenario inside CheckHome.feature using
vendor/bin/behat
I get the following error:
Behat\Behat\Context\Exception\ContextNotFoundException]
`FeatureContext` context class not found and can not be used.
Which is the correct way to set up autoload so it recognises my context?
Thanks