← Back to Discord Forum

Tests failing more or less randomly with too many workers?

I noticed that some of my tests fail with strange errors when too many of them are run in parallel. ("Strange errors" means: they pass when run in isolation and the corresponding part of the system also works when tested manually, but the tests e.g. time out in places known to work correctly for seemingly no reason.) Is it an expected/documented/known behavior? I set my tests up so that the number of tests launched in parallel is equal to the number of cores on the machine running the tests; is it possible that this is too much? Is this phenomenon the reason why the default number of workers is half the number of cores?

This thread is trying to answer question "Is it expected/known behavior for tests to fail with strange errors when too many of them are run in parallel, and is it possible that this is due to resource contention issues? What is the recommended number of workers to use?"

2 replies

@mbork.pl Running a large number of tests in parallel can lead to resource contention issues. This includes CPU, memory, disk I/O, and network bandwidth. If your tests are resource-intensive, launching too many of them concurrently could overload the system and cause unexpected behavior.

You should set your workes 50% according to your total CPU count

If your CPU count is 8 ,you should use 4 workes. This is recommended by playwright team

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.