2017-01-09 90 views
1

目前我们有一个使用Codeception 2.0.16构建的大型验收套件。 我们想升级到Codeception 2.2.5。但是,在安装Codeception 2.2.5(通过phar)之后,我们无法运行我们的测试套件。Codeception命名空间

我们收到的错误是(在底部附加的详情):

[Codeception \异常\的ConfigurationException] 模块WebHelper无法找到并加载

显然新版本具有装载影响我们套件的变化。

我已搜索迁移说明来帮助我们进行此升级,但没有看到任何迁移说明。

Addtional详细

  • Codeception版本:2.016 ==> 2.2.5
  • PHP版本:5.6.9
  • 操作系统:CentOS的
  • 安装类型:
  • 的Phar

Codeception PROJECT配置

说明:经过测试并更改代码的几个部分后,我发现主要问题与命名空间有关。正如你可以在下面看到的,我们使用一个名为“SM”的命名空间,以及这个os如何导致问题。

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 

注:

一)我已经加入“命名空间小号米;”在测试/ _helpers/WebHelper的顶部。PHP(没有工作)

B)我也试过这样:(没有工作)

modules: 
    enabled: 
     - \WebHelper (or \SM\WebHelper or any other combination) 

C)我也装codeception的清洁版本从codeception的网站:

  • 下载codeception(wget的http://codeception.com/codecept.phar
  • 安装了它(codecept自举)
  • 创建简单的测试,只是为了测试目的(codecept产生:CEPT验收欢迎)

添加 “命名空间SM;”并据此助手,我也得到了同样的错误,在这种情况下:

助手\验收无法找到并装载

d)我还试图用codeception的“附加命名空间”命令没有运气

任何想法将不胜感激。

感谢,

回答

0

在我的情况下,错误提及另一个文件,但原因并解决方案可以是相同的。

至少几个小时的调试和搜索到我的问题,我找到了答案网络后: http://phptest.club/t/class-helper-acceptance-does-not-exist/808

就我而言,我的主要项目的的.gitignore曾在它_*线。正因为如此,codeception目录还没有提交,尤其是包含请求文件的_support directy。

删除我的.gitignore中的_*行并提交并拉取文件,然后修复问题。

希望这会有所帮助。

+0

此答案与问题无关! –

0

在代码中,必须构建'帮助者'。尝试发出命令:

codecept build 

然后再次运行它。