Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to use codeception parameters in test code

I have environment configuration in my acceptance.suite.yml config file. One of the parameters is language. I need to know this parameter value in the actual test code to be able to drive test steps correctly.

acceptance.suite.yml config content:

 class_name: WebGuy
modules:
    enabled:
        - WebDriver
        - WebHelper
        - Db
    config:
        WebDriver:
            browser: firefox
env:
    eng:
        modules:
            config:
                WebDriver:
                   url: 'localhost'
                   lang: en
   esp:
        modules:
            config:
                WebDriver:
                    url: 'localhost'
                    lang: es

How can I get the language parameter value?

like image 266
Wonderas Avatar asked Mar 07 '14 19:03

Wonderas


People also ask

How do I run Codeception test?

codecept run --steps : print step-by-step execution. codecept run -vv : print steps and debug information. codecept run --debug : alias for -vv. codecept run -vvv : print Codeception-internal debug information.

Does Codeception use selenium?

Codeception is very flexible framework that you can use to write your Selenium tests.

Which Codeception method may be used to check that a variable is greater than expected?

assertGreaterThanOrEqual. Asserts that a value is greater than or equal to another value.


1 Answers

I had the same problem and found help on Codeception forums. Here's how you can access config content as mentioned by user Dan.

$config = \Codeception\Configuration::config();
$apiSettings = \Codeception\Configuration::suiteSettings('api', $config);
like image 121
George Avatar answered Nov 03 '22 00:11

George