简体   繁体   English

编码接收,配置套件测试路径

[英]Codeception, configure suite test path

I'm having a problem with Codeception. 我对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. 根据上面的套件配置,在config> Yii1> appPath下:该路径是固定的,并且仅对我有效,但是不幸的是,此配置对我团队中的其他人无效。 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. 感谢@Rob forrest,因此我将其作为答案。

Currently I found a solution to get this situation, I see --env option can be used to this, and here is the configuration: 当前,我找到了解决此问题的解决方案,我看到--env选项可用于此,这是配置:

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 最后,要运行测试,只需添加--env选项,如下所示: codecept run functional --env my_envcodecept 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 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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