Symfony / Codeception运行错误

时间:2016-03-31 01:21:53

标签: symfony codeception

我有一个Symfony 2.4.4站点,其中包含简单的Codeception(2.1.7)验收测试设置。运行验收测试时,我收到以下错误:

[Codeception\Exception\ConfigurationException]
AcceptanceTester class doesn't exist in suite folder.
Run the 'build' command to generate it

AcceptanceTester类确实存在于tests/acceptance目录中。如果我运行构建,我会收到以下错误:

[Codeception\Exception\ConfigurationException]
Configuration file could not be found.
Run `bootstrap` to initialize Codeception.

codeception.yml文件确实存在并包含以下内容:

actor: Tester
paths:
    tests: tests
    log: tests/_output
    data: tests/_data
    helpers: tests/_support
settings:
    bootstrap: _bootstrap.php
    colors: false
    memory_limit: 1024M
coverage:
    enabled: true
    remote: true
    include:
        - app/*
    exclude:
        - app/cache/*
include:
    ...
modules:
    config:
        Db:
            dsn: ''
            user: ''
            password: ''
            dump: tests/_data/dump.sql

如果我运行一个bootstrap,它会确认:

Project is already initialized in '.'

acceptance.suite.yml包含:

class_name: AcceptanceTester
modules:
    enabled:
        - AcceptanceHelper

有什么建议吗?

3 个答案:

答案 0 :(得分:1)

  1. AcceptanceTester.php文件应位于tests / _support目录中。 运行codecept build以重新生成Tester文件。

  2. 您没有启用accepted.suite.yml的模块。 您必须启用Symfony2,PhpBrowser和WebDriver之一。

  3. 您的网站使用旧版本的Symfony,如果使用Symfony2模块,可能会导致Codeception问题,因此我建议使用PhpBrowser或WebDriver对其进行测试。

答案 1 :(得分:0)

我相信,你需要运行命令codecept bootstrap

答案 2 :(得分:0)

我遇到了这个问题,我意识到我运行了codecept bootstrap,但vendortests文件夹位于错误的目录中。

我跟着this video,它帮助了我。