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

[Question] is workerIndex consistent during tests? #19519

Closed
vovsemenv opened this issue Dec 16, 2022 · 1 comment
Closed

[Question] is workerIndex consistent during tests? #19519

vovsemenv opened this issue Dec 16, 2022 · 1 comment

Comments

@vovsemenv
Copy link
Contributor

Hello, at allure-report we have timeline view with all the used threads and timings. and this timeline uses workerIndex to determine which thread was used.

image

I found that workerIndex is not always consistent during tests. It can be reproduced when we have a lot of tests of when we repeat each multiple times.

So is it bug that workers have index more than total amount of workers??

reproduction

❯ npm run test -- --repeat-each 5                                             

> pw-primer@1.0.0 test
> playwright test --repeat-each 5

Total workers: 2
tesworker index: 0; testName: should allow me to mark all items as completed
tesworker index: 1; testName: should allow me to clear the complete state of all items
tesworker index: 1; testName: should allow me to add todo items
tesworker index: 0; testName: complete all checkbox should update state when items are completed / cleared
tesworker index: 1; testName: should clear text input field when an item is added
tesworker index: 0; testName: should append new items to the bottom of the list
tesworker index: 2; testName: should allow me to mark all items as completed
tesworker index: 3; testName: should allow me to clear the complete state of all items
tesworker index: 2; testName: complete all checkbox should update state when items are completed / cleared
tesworker index: 3; testName: should allow me to add todo items
tesworker index: 2; testName: should clear text input field when an item is added
tesworker index: 3; testName: should append new items to the bottom of the list
tesworker index: 4; testName: should allow me to mark all items as completed
tesworker index: 5; testName: should allow me to clear the complete state of all items
tesworker index: 4; testName: complete all checkbox should update state when items are completed / cleared
@yury-s
Copy link
Member

yury-s commented Dec 17, 2022

Worker index used for a test is not guaranteed to be the same across test runs, it depends on multiple factors. See this page, worker index will increase when a new worker process is used (e.g. after previous test failures). There is also parallelIndex which may be a better fit for your use. Note that worker index assignment is an implementation detail and it may change in the future depending on the algorithm we use for parallelizing the tests.

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

2 participants