question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] file order with multiple workers

See original GitHub issue

From looking at the documentation there doesn’t seem to be a way to specify the order that tests are run while also allowing multiple workers.

I’m currently using playwright to test a fairly complex web hosting application that has a lot of platform based settings. These settings can take a long time to update (over 1 minute) and can cause other tests to fail as they affect all users. At the moment we’re just using the single worker in the CI pipeline but as the number of tests grow this will mean the test suite will take a very long time to complete.

I was thinking of a more fully featured “test list” file where you can specify items to run sequentially and items that ok to run in parallel.

// test.list.ts
import './feature-b.spec.ts';
import './feature-a.spec.ts';
// new.test.list.ts
[
   './global-setting-a.spec.ts',  // changes to global setting
   ['./depends-on-a-1.spec.ts', './depends-on-a-2.spec.ts', '.depends-on-a-3.spec.ts', ...etc], // runs in parallel
   './global-setting-b.spec.ts'
   // runs any other tests in parallel that are not specified.
]

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rwollcommented, Aug 8, 2022

The timing here is very nice! Please watch: https://github.com/microsoft/playwright/issues/14895#issuecomment-1207665459. Folding into that issue.

0reactions
TJHdevcommented, Aug 5, 2022

It looks like the documentation was recently updated for “test list” files.

I was thinking something along the lines of syntax like this, but it’s just a rough idea.

import { test } from '@playwright/test';

import addEmailRole from 'components/platform/addEmailRole.spec'
import addBackupRole from 'components/platform/addBackupRole.spec'
import removeEmailRole from 'components/platform/removeEmailRole.spec'
import removeBackupRole from 'components/platform/removeBackupRole.spec'

import addEmails from 'components/addEmails.spec';
import emailsBulkActionBar from 'components/emailsBulkActionBar.spec';

import addWebsite from 'components/addWebsite.spec';
import websitesBulkActionBar from 'components/websitesBulkActionBar.spec';
import backups from 'components/website/backups.spec'

test.describe(addEmailRole);  // won't start the next line until all tests have completed.
test.describe([emailsBulkActionBar, addEmail]);  // workers can be assigned to any tests within these files as the same time. Again the next line won't be started until all tests have completed.
test.describe(removeEmailRole);
test.describe(addBackupRole);
test.describe([backups, addWebsite, websitesBulkActionBar]);
test.describe(removeBackupRole);

Important point is that multiple workers can be assigned. In the example above if 6 workers are allocated:

  1. While addEmailRole is being worked through only 1 worker is being used, while 5 sit idle.
  2. Once [emailsBulkActionBar, addEmail] begins all 6 workers can be allocated.
  3. removeEmailRole won’t start until all the tests have completed in [emailsBulkActionBar, addEmail]
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to define Execution Order of Hooks in Cucumber - Tools QA
Above we mentioned two before and two after hooks. Execute the feature file as a whole and see the output below. Output Feature:...
Read more >
How to order feature files in Cucumber test suite?
Cucumber features/scenarios are run in Alphabetical order by feature file name. However, if you specifically specify features, ...
Read more >
Multi Process Workers - Fluentd
The multi-process workers feature launches multiple workers and use a separate process per worker. fluentd provides several features for multi-process workers.
Read more >
Parallel Execution - Cucumber Documentation
Create a parallel folder (or any other name) in src/test/resources path and add the two feature files ( scenarios.feature and scenario-outlines.feature ) ...
Read more >
Organizing Test Suite - WebdriverIO
In general, try to test only a single feature per spec file. Try to not have too many or too few tests in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found