Skip to content

Add custom work partitioning for parallel runtime. #1044

Closed
@stevecooperorg

Description

@stevecooperorg

I've looked at the experimental parallel testing feature, and I think it may need a mechanism for controlling how how different slaves are given work.

Looking at cucumber-js/src/runtime/parallel/master.js:110, I can see that slaves are given work from a queue. That sounds great in the general case, but I couldn't make use of it as-is. If my case is similar to others, I'd like to suggest that it should be possible to change the work allocation strategy.

I'm running e2e tests using Selenium, and different tests access several different databases. So my features look like;

Scenario: I can log in to the db1 database
 When I log in to the "db1" database
 Then ...

Scenario: I can create a user in the db2 database
 When I log in to the "db2" database
 Then ...

Those databases are shared resources, and are restored to a server, used, and dropped during the tests. If two slaves were to try to access the same database at the same time, they'll fail.

On my end, I can partition feature files out to slaves appropriately;

| feature         | database | slave |
| test1.feature   | dbA      |     1 |
| test2.feature   | dbB      |     1 |
| test3.feature   | dbC      |     2 |
| test4.feature   | dbC      |     2 |
| test5.feature   | dbC      |     2 |

But I don't see a mechanism where the parallel test runner can ask me where I'd like to run the scenario.

Would it be possible to have an extension point, a 'custom work partitioner', which would ask something like;

getSlaveAffinity(featureFilePath, numberOfSlaves); 

which would return the slave to put the feature file on?

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