Skip to content

createGroupsOfSuites does not create groups for multiple configurations in same script #3617

@nikzupancic

Description

@nikzupancic

What are you trying to achieve?

I'm using a custom script (based on example from docs https://codecept.io/parallel/#custom-parallel-execution) to run tests in multiple workers. Until now I was running 2 configurations separately - each one using its own workers script (1 using Appium, the other one using WebDriver). The tests are not shared so Appium is using own set of tests and WebDriver its own.

What I'm trying to do now is use a single script that could spawn workers for both configs. Where I'm having issues is it seems that createGroupsOfSuites always returns test groups that were made with its first call (see example code and output below).

For simplicity imagine this scenario: I have Appium tests saved in folder ./app_tests and WebDriver tests in ./web_tests. There is only 1 test for Appium, WebDriver has 5 in total so when I print the function output, the difference between 2 groups of tests should be easily visible

Here is the code snippet that I'm using:

const webWorkerConfig = {
    testConfig: './codecept.web.conf.js',
}

const appWorkerConfig = {
    testConfig: './codecept.app.conf.js',
}

const w1 = new Workers(null, appWorkerConfig)
const w2 = new Workers(null, webWorkerConfig)

console.log(w1.createGroupsOfSuites(2))
console.log(w2.createGroupsOfSuites(2))
return

What do you get instead?

Running the above gives me this output (same test in both calls)

[ [ 'YogKnf+yRVoqg8mNlhmDsQ' ], [] ]
[ [ 'YogKnf+yRVoqg8mNlhmDsQ' ], [] ]

Or if I switch the order of createGroupsOfSuites calls:

[
  [
    'YFEBtKn5JNYfZBnRf1F6+A',
    'CiL6FOiFYsqMTCdMor2DMg',
    'DdywGjpvgY2u2FrUM4f/rQ'
  ],
  [ 'n9GgEbyTUqEGNZMKgULsfQ', 'DPQ4PW/L/OHvPsHJJaImLw' ]
]
[
  [
    'YFEBtKn5JNYfZBnRf1F6+A',
    'CiL6FOiFYsqMTCdMor2DMg',
    'DdywGjpvgY2u2FrUM4f/rQ'
  ],
  [ 'n9GgEbyTUqEGNZMKgULsfQ', 'DPQ4PW/L/OHvPsHJJaImLw' ]
]

What I'm expecting to see is this (2 different sets of tests):

[
  [
    'YFEBtKn5JNYfZBnRf1F6+A',
    'CiL6FOiFYsqMTCdMor2DMg',
    'DdywGjpvgY2u2FrUM4f/rQ'
  ],
  [ 'n9GgEbyTUqEGNZMKgULsfQ', 'DPQ4PW/L/OHvPsHJJaImLw' ]
]
[ [ 'YogKnf+yRVoqg8mNlhmDsQ' ], [] ]

The only way I was able to get the expected output was by calling container.createMocha() between the two calls but I'm not sure if this comes with any side effects?

console.log(w1.createGroupsOfSuites(2))
container.createMocha()
console.log(w2.createGroupsOfSuites(2))

Is this expected behaviour when calling createGroupsOfSuites for multiple workers within the same script?

Details

  • CodeceptJS version: 3.4.1
  • NodeJS Version: v19.7.0
  • Operating System: macOS Monterey 12.6.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions