简体   繁体   中英

Codeception, configure suite test path

I'm having a problem with Codeception.

I have a project that involving team, and I want to implement test with codeception and this test should work for everyone in my team.

currently I setup the test for my own-purpose, and here is the example configuration of it:

class_name: FunctionalTester
modules:
    enabled:
        # add framework module here
        - Yii1
        - \Helper\Functional
        - PhpBrowser
        - Db
    config:
        Yii1:
            appPath: '/Volumes/disk0s4/www/new-proj/trunk/test.php'
            url: 'https://my.proj.local/test.php'
        PhpBrowser:
            url: 'https://my.proj.didin/'
        Db:
            dsn: 'mysql:host=127.0.0.1;dbname=test-proj-new'
            user: 'root'
            password: 'root'
            dump: ''

According to suite-configuration above, under config > Yii1 > appPath: the path is fixed, and it working well only for me, but unfortunately this configuration won't work for other people in my team. So other people should have self-configuration file for this, but keep to run the same test-file.

So, do you have any idea to handle the kind of this situation? I really appreciate all of your input and thanks a lot for attention.

Thanks for @Rob forrest, so I put it as the answer here.

Currently I found a solution to get this situation, I see --env option can be used to this, and here is the configuration:

class_name: FunctionalTester
modules:
    enabled:
        # add framework module here
        - Yii1
        - \Helper\Functional
        - PhpBrowser
        - Db
    config:
        Yii1:
            appPath: '/Volumes/disk0s4/www/new-proj/trunk/test.php'
            url: 'https://my.proj.local/test.php'
        PhpBrowser:
            url: 'https://my.proj.didin/'
        Db:
            dsn: 'mysql:host=127.0.0.1;dbname=test-proj-new'
            user: 'root'
            password: 'root'
env:
    my_env:
       modules:
            enabled:
                - Yii1
                - \Helper\Functional
            config:
                Yii1:
                     appPath: 'path to index.php of my environment'
                     url: 'http://my.local/test.php'
    production_env:
       modules:
            enabled:
                - Yii1
                - \Helper\Functional
            config:
                Yii1:
                     appPath: 'path to index.php of production environment'
                     url: 'http://my.local.com/test.php'

finally, to run the test, just add --env option as follows: codecept run functional --env my_env or codecept run functional --env production_env

at least this is the only way that I implemented for now, but I still open any input from all of you.

Thank you

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