【发布时间】:2015-02-12 04:42:02
【问题描述】:
我过去曾尝试过 Behat 2.5,设置它没有任何问题,但现在我刚刚下载了 Behat 3,尝试设置它时遇到了一些困难。
我的问题是,在全新安装之后,如果我创建一个 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
当我尝试使用 CheckHome.feature 运行场景时
vendor/bin/behat
我收到以下错误:
Behat\Behat\Context\Exception\ContextNotFoundException]
`FeatureContext` context class not found and can not be used.
设置自动加载以识别我的上下文的正确方法是什么?
谢谢
【问题讨论】:
标签: php composer-php autoload behat