简体   繁体   中英

Using Codeception acceptance tests with symfony 2

I want to use Codeception to write some acceptance tests in symfony 2 project. I don't want to use PhpBrowser but symfony envoriment.

Original acceptance.suite.yml

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser:
            url: http://localhost/myapp
        - \Helper\Acceptance

I change it to:

class_name: AcceptanceTester
modules:
    enabled: Symfony2
    config:
        Symfony2:
            app_path:   'app'
            environment:    'test'

But now i can't use \\Helper\\Acceptance to write my tests using codeception

$I = new AcceptanceTester($scenario);
$I->wantTo('choose my store');
$I->amOnPage('/');
$I->amGoingTo('/welcome');

How to set up config to run tests on app, instead via PhpBrowser?

It looks like you used pre-2.1 style of configuration.

http://codeception.com/06-30-2015/codeception-2.1-is-here.html

Module config simplified: Modules can be configured in enabled section of suite config. Take a look of this sample declaration of Api suite, there is no config section inside modules.

Correct way is:

class_name: AcceptanceTester
modules:
    enabled:
        - Symfony2:
            app_path:   'app'
            environment:    'test'

http://codeception.com/docs/modules/Symfony2#Example-functionalsuiteyml---Symfony-2x-Directory-Structure

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM