我曾嘗試過Behat 2.5,並且沒有設置它的問題,但現在我剛剛下載Behat 3,並且在嘗試設置時遇到一些困難它起來。Behat 3 - `FeatureContext`上下文類未找到並且無法使用
我的問題是,全新安裝後,如果我創建一個behat.yml文件,我似乎無法定義FeatureContext文件的位置,我無法運行任何測試。
我composer.json就像如下:
{
"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": "*"
}
}
我的項目文件夾結構方式如下:
behat/
bootstrap/
FeatureContext.php
config/
behat.yml
features/
CheckHome.feature
vendor/
composer.json
composer.lock
而且我behat.yml文件:
default:
autoload:
'': %paths.base%/../bootstrap
suites:
default:
paths:
- %paths.base%/../features
contexts:
- FeatureContext
當我嘗試使用
vendor/bin/behat
我收到以下錯誤內運行CheckHome.feature場景:
Behat\Behat\Context\Exception\ContextNotFoundException]
`FeatureContext` context class not found and can not be used.
這是設置自動加載所以我承認語境正確的方法是什麼?
謝謝
這和原來的完全一樣嗎? – Nealv 2014-12-17 12:36:07