2017-01-09 95 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 

然後再次運行它。