【发布时间】:2017-05-24 01:49:48
【问题描述】:
目前我们有一个使用 Codeception 2.0.16 构建的大型验收套件。 我们想升级到 Codeception 2.2.5。但是,在安装 Codeception 2.2.5(通过 phar)之后,我们根本无法运行我们的测试套件。
我们收到的错误是(底部的其他详细信息):
[代码接收\异常\配置异常] 无法找到和加载模块 WebHelper
显然,新版本的加载更改会影响我们的套件。
我已搜索迁移说明以帮助我们进行此升级,但没有看到任何说明。
其他详情
- 代码接收版本:2.016 ==> 2.2.5
- PHP 版本:5.6.9
- 操作系统:CentOS
- 安装类型:Phar
Codeception PROJECT 配置
注意:在测试和更改了代码的几个部分后,我注意到主要问题与命名空间有关。正如你在下面看到的,我们使用了一个名为“SM”的命名空间,以及这个操作系统如何导致问题。
codeception.yml
namespace: SM
paths:
tests: tests
log: tests/_log
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
log: true
strict_xml: true
modules:
config:
Db:
dsn: 'mysql:host=xxxxxxxxxxxx;dbname=<DB_NAME>'
user: 'USER'
password: '********'
dump: tests/_data/dump.sql
populate: false
cleanup : false
验收套件配置
class_name: WebGuy
modules:
enabled:
- WebDriver
- WebHelper
- SistemWSClient
- TestingSupportWSClient
- Db
- TempFileManager
- Asserts
config:
WebDriver:
url: 'http://xxxxxxxxxxxxxxxxxx/codeception'
browser : firefox
host: xxxxxxxxxxxxx
port: 4444
wait: 0
restart: true
capabilities:
unexpectedAlertBehaviour: 'accept'
SistemWSClient:
url: xxxxxxx
TestingSupportWSClient:
url: 'http://x/codeception/rest.php'
Db:
dsn: 'mysql:host=xx;port=3306;dbname=x'
user: 'xxxxxxx'
password: 'xxxxxxx'
dump: 'some/dump/file'
populate: false
cleanup: false
注意事项:
a) 我添加了“namespace SM;”在 tests/_helpers/WebHelper.php 的顶部(它不起作用)
b)我也试过这个:(没用)
modules:
enabled:
- \WebHelper (or \SM\WebHelper or any other combination)
c)我还从 codeception 的网站安装了一个干净的 codeception 版本:
- 已下载代码接收 (wget http://codeception.com/codecept.phar)
- 已安装(codecept 引导程序)
- 仅为测试目的创建了简单的测试(codecept generate:cept accept Welcome)
添加了“命名空间 SM;”和 Helpers 相应地,我得到同样的错误,在这种情况下:
Helper\Acceptance 无法找到并加载
d)我也尝试过使用 codeception 的“add-namespace”命令,但没有运气
任何想法将不胜感激。
谢谢,
【问题讨论】:
标签: php testing automation namespaces codeception