2016-03-30 23 views
0

是否可以将配置参数传递给扩展\Codeception\Module类的帮助程序类。 我有以下情况,我想在我的api.suite.yml配置文件中的模块启用部分设置例如Helper\Api并将其设置为cofig属性。CodeCeption - 将选项传递给帮助程序

我的想法是有不同的配置属性的环境。 这可能吗?

class_name: ApiTester 
modules: 
    enabled: 
     - \Helper\Api:  # This is my module 
     my_path: C://ssss # This is my custom option I want to pass. 

我的模块类。

[Codeception\Exception\ModuleConfigException] 
    Helper\Api module is not configured! 

    Options: my_path are required 
    Please, update the configuration and set all the required fields 
+0

你读过http://codeception.com/docs/06-重复使用TestCode#配置? – Naktibalda

+0

是的,我读过它,我想我做了一切描述。 – bozhidarc

回答

1

你必须要缩进参数的更多:

class Api extends \Codeception\Module 
{ 
    protected $requiredFields = ['my_path']; 
    ... 
} 

当我跑了套房设有失败 class_name: ApiTester modules: enabled: - \Helper\Api: # This is my module my_path: C://ssss # This is my custom option I want to pass.

+0

你摇滚!谢谢! – bozhidarc