Codeception, configure suite test path

萝らか妹 提交于 2019-12-14 02:41:57

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/32177532/codeception-configure-suite-test-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!