Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging two or more environments not working - Codeception #5254

Open
axboory opened this issue Nov 2, 2018 · 3 comments
Open

Merging two or more environments not working - Codeception #5254

axboory opened this issue Nov 2, 2018 · 3 comments

Comments

@axboory
Copy link

axboory commented Nov 2, 2018

What are you trying to achieve?

I'm writing an acceptance test suite and I have to make the environments easily configurable, but for this to work I need to be able to merge two or more environments (geoLocation, browser, os, urls).

What do you get instead?

If I run: .\codecept run tests\acceptance\acceptanceTestCest --env firefox the tests start running without issues with any environment I choose.

Now my problem is that if I try to merge the environments: .\codecept run tests\acceptance\acceptanceTestCest --env firefox,US I get the following message :

In Configuration.php line 306:
[Codeception\Exception\ConfigurationException]
Suite tests\acceptance\acceptanceTestCest.php was not loaded

And if I try to merge more than two environments i get this message:

Too many arguments, expected arguments "command" "suite" "test".

Details

  • Codeception version: 2.4.5
  • PHP Version: 7.2.8
  • Operating System: Windows server 2012
  • Installation type: Composer 1.7.2

My acceptance.suite.yml :

 actor: AcceptanceTester
    modules:
        enabled:
            - WebDriver:
                url: http://localhost
            - REST:
                depends: PhpBrowser
                url: 'http://localhost/api/'
            - \Helper\Acceptance
        config:
            WebDriver:
                host: 'user:key@hub.browserstack.com'
                port: 3214
                browser: chrome
                capabilities:
                    os: Windows
                    os_version: 10
                    browserstack.local: true # for local testing
    env:
        AU:
            modules:
                config:
                    WebDriver:
                        capabilities:
                            browserstack.geoLocation: AU
        US:
            modules:
                config:
                    WebDriver:
                        capabilities:
                            browserstack.geoLocation: US
        CA:
            modules:
                config:
                    WebDriver:
                        capabilities:
                            browserstack.geoLocation: CA
        firefox:
            modules:
                config:
                    WebDriver:
                        browser: firefox    
        safari:
            modules:
                config:
                    WebDriver:
                        browser: safari

I looked everywhere for this issue and I did not find anyone that even encountered it. The closest thing I found was that tests would be ran only with the second environment.

I'm new to Codeception and probably I am missing something.
I read the documentation on https://codeception.com/docs/07-AdvancedUsage#Environments and I don't seem to do anything wrong from there.

Things I tried:

Put the environments in _envs folder.
Put the environments in codeception.yml

Other things I cannot remember right now.

Thanks !

EDIT: Also I have the project on jenkins as well and merging environments works perfectly there, but if I try to download the exact same project and run it locally it still doesn't work.

@mvadzim
Copy link

mvadzim commented Nov 5, 2018

try to add in acceptanceTestCest @env annotation,
exemple:

class AcceptanceTestCest
{
    /**
     * @env firefox
     * @env chrome
     * @env safari
     */
    public function acceptanceTest( ....

@axboory
Copy link
Author

axboory commented Nov 6, 2018

try to add in acceptanceTestCest @env annotation,
exemple:

class AcceptanceTestCest
{
    /**
     * @env firefox
     * @env chrome
     * @env safari
     */
    public function acceptanceTest( ....

I tried that but it did not work.

Also I have the project on jenkins as well and merging environments works perfectly there, but if I try to download the exact same project and run it locally it still doesn't work.

@hadouke
Copy link

hadouke commented Apr 24, 2020

Any update?
I've encountered this while running suite in Jenkins with Codeception 4.1.4, but for me error occurrs only when -o or --override option added. However, running same combination locally works perfect.

My command looks like this
/vendor/bin/codecept run api --env env1 --env env1,role1 --env env1,role2 --env env1,role3 -x groupname -g groupname -o "modules:config:rest:email:useremail@domain.com" -html -xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants