Parallel runs: workers and sharding
Run Playwright tests at the same time with workers on one machine and shards on many, and keep them from stepping on each other's data.
L1–L4 are part of the Pro pass
L0 Explain simply
Analogy: many checkout lanes opened at the supermarket. On a quiet morning one lane is enough. At the evening rush the queue is long, so the shop opens more lanes. Each lane serves a different customer at the same time. Everybody leaves sooner.
Daily List is a to-do list app. Tom's has grown. One run now takes a long time. Nina wants a faster answer before each release.
If one machine has no more room, Tom can open a second shop. Each shop serves a share of the customers.
The picture has limits. Customers in separate lanes do not touch each other's shopping. Tests can, if they share data, such as one account with one email address.
What it is: Playwright is a free library from Microsoft that drives a real browser from code. This topic is one slice of that library: running tests at the same time. A is one lane, a separate process with its own browser. is the setting fullyParallel: true. It lets tests inside one file run together, not only whole files. A test shard is one slice of the suite on its own machine, chosen with --shard=1/3. The nearest neighbour is one worker and one machine. That is simpler, and it is slow once the suite is large.
Why it matters: A long suite blocks every . Mei waits, and the review goes stale. Workers and shards cut the clock time. They also create a new kind of failure. Two tests that share lily@example.com pass alone and fail together. Tom needs both the speed and a way to see that clash.
(SYNTHETIC / TRAINING ONLY: Daily List, the site daily-list.example and every person named in this lesson are invented.)
PLAIN WORDS · 3 in this section
- playwright
- a free Microsoft tool that drives a browser for tests
- shard
- one group of checks in a split suite
- shards
- the groups that a split suite is divided into
PICTURE IT
The picture is the one the lesson above opens with. The table below shows how each part of it matches the software.
THE REAL JOB Doing the same work in several places at once to get results sooner, without the places getting in each other's way.
- Open more lanes
- Open more shops
- Give each test its own data
- Merge the reports
HOW THE PICTURE MAPS
| In the picture | In the software |
|---|---|
| Checkout lanes | Workers on one machine |
| Opening a second shop | Shards on other machines |
| A customer in a lane | A test file |
| Two customers wanting the last item | Tests sharing the same data |
WHERE THIS PICTURE STOPS
- Shoppers in lanes do not share a basket. Tests can share data.
- A shop can open lanes without limit. A machine has a limit.
- A queue is first come first served. Test order can matter.
HOOK
More lanes, but no shared basket.
REMEMBER IT THIS WAY
A sequence: the real steps, in order.
Lanes on one machine are workers, another shop on another machine is a shard. Before adding either, do two tests want the same data?
| In the trick | What it stands for |
|---|---|
| worker | a lane on one machine |
| shard | a share of files on another machine |
A machine has a limit, so more workers is not always faster.
TELL A FRIEND
Many checkout lanes opened at the supermarket, and a second shop for the rush.
OFTEN MIXED UP WITH Flaky tests. The flaky tests lesson explains why tests can fail at random. This lesson shows the running of tests in parallel, which can cause some of those failures.
Sources & standards — 5 sources
- Market practice
Parallelism (Playwright documentation) ↗ — Microsoft · Test files run in parallel in worker processes; fullyParallel runs tests inside a file in parallel; workers default to half the logical CPU cores; serial mode runs a group in order (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Sharding (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
Isolation (Playwright documentation) ↗ — Microsoft (Playwright) · Each test runs in its own browser context, so cookies and storage are not shared between tests (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
ISTQB Certified Tester Foundation Level Syllabus v4.0.1 ↗ — International Software Testing Qualifications Board · Section 6.2, Benefits and Risks of Test Automation: a tool needs ongoing effort to give lasting benefits, and its risks need analysis and mitigation (confirmed against the syllabus, read in full text from a mirror copy of the publisher PDF, v4.0.1, 15 September 2024)
v4.0.1 is dated 15 September 2024 and is a list of corrections to v4.0 (21 April 2023) that reworded six learning objectives — not a cosmetic reissue. 78 pages.
Two traps this entry exists to stop. v4.0.2 is the German edition (1 March 2025, 94 pages), so sorting by version number reaches the wrong document. And the widely-repeated per-chapter question allocation "8 / 5 / 4 / 11 / 9 / 3" is wrong: it is 8 / 6 / 4 / 11 / 9 / 2, derived from three official sample-exam answer keys and confirmed against the Exam Structure Tables.
The single most consequential detail for a question bank: white-box coverage — statement and branch — is K2 "Explain", not K3 "Apply" (FL-4.3.1, FL-4.3.2, FL-4.3.3), and MC/DC, path and condition coverage are declared out of scope in §4.3. A question asking a candidate to compute branch coverage is testing something this syllabus does not.
Read through a mirror, because the publisher's own domain could not be fetched (a reachability gap, not a statement about the publisher). A 403 there is a policy refusal and says nothing about whether the document exists or is reachable elsewhere.
Anyone on an unrestricted network should open the canonical URL above and confirm the section and page numbers cited against it. Every claim drawn from this entry is written so that it can be checked against a numbered page.
Read from two independent PDF-to-markdown conversions mirrored on raw.githubusercontent.com. They are treated as faithful because they were produced by unrelated parties with different tooling, agree on the full 64-item objective set including wording, and reproduce the same internal inconsistency present in the source PDF. Chapter 1 reads "testware that supports" where Appendix B reads "that support". A conversion artefact does not replicate across two toolchains.
The licence permits attributed non-commercial extracts and use as the basis for articles. Whether a site that sells a pass may rely on that is an owner's decision, not this entry's.
7 November 2026 review: actual publisher PDF 4.0.1, 15 September 2024, 78 pages, front matter/copyright and relevant numbered operative sections 0.5–0.10 and chapters 1–6 compared with CTFLpractice lessons. Earlier mirror/search descriptions are historical access records. TheK2 white-box objectives require explanation; the source does not justify a categorical ban on small numeric illustrations that support explanation. Later Exam Rules 1.2§4.1.4 usesK2 for keyword definitions, while syllabus§0.5 usesK1; keep dated scopes distinct. No copied questions or figure assets.
- Market practice
Parallelism (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
PRACTISE AND KEEP
Sources for this topic — 8 sources
- Market practice
Parallelism (Playwright documentation) ↗ — Microsoft · Test files run in parallel in worker processes; fullyParallel runs tests inside a file in parallel; workers default to half the logical CPU cores; serial mode runs a group in order (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Sharding (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
Isolation (Playwright documentation) ↗ — Microsoft (Playwright) · Each test runs in its own browser context, so cookies and storage are not shared between tests (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
ISTQB Certified Tester Foundation Level Syllabus v4.0.1 ↗ — International Software Testing Qualifications Board · Section 6.2, Benefits and Risks of Test Automation: a tool needs ongoing effort to give lasting benefits, and its risks need analysis and mitigation (confirmed against the syllabus, read in full text from a mirror copy of the publisher PDF, v4.0.1, 15 September 2024)
v4.0.1 is dated 15 September 2024 and is a list of corrections to v4.0 (21 April 2023) that reworded six learning objectives — not a cosmetic reissue. 78 pages.
Two traps this entry exists to stop. v4.0.2 is the German edition (1 March 2025, 94 pages), so sorting by version number reaches the wrong document. And the widely-repeated per-chapter question allocation "8 / 5 / 4 / 11 / 9 / 3" is wrong: it is 8 / 6 / 4 / 11 / 9 / 2, derived from three official sample-exam answer keys and confirmed against the Exam Structure Tables.
The single most consequential detail for a question bank: white-box coverage — statement and branch — is K2 "Explain", not K3 "Apply" (FL-4.3.1, FL-4.3.2, FL-4.3.3), and MC/DC, path and condition coverage are declared out of scope in §4.3. A question asking a candidate to compute branch coverage is testing something this syllabus does not.
Read through a mirror, because the publisher's own domain could not be fetched (a reachability gap, not a statement about the publisher). A 403 there is a policy refusal and says nothing about whether the document exists or is reachable elsewhere.
Anyone on an unrestricted network should open the canonical URL above and confirm the section and page numbers cited against it. Every claim drawn from this entry is written so that it can be checked against a numbered page.
Read from two independent PDF-to-markdown conversions mirrored on raw.githubusercontent.com. They are treated as faithful because they were produced by unrelated parties with different tooling, agree on the full 64-item objective set including wording, and reproduce the same internal inconsistency present in the source PDF. Chapter 1 reads "testware that supports" where Appendix B reads "that support". A conversion artefact does not replicate across two toolchains.
The licence permits attributed non-commercial extracts and use as the basis for articles. Whether a site that sells a pass may rely on that is an owner's decision, not this entry's.
7 November 2026 review: actual publisher PDF 4.0.1, 15 September 2024, 78 pages, front matter/copyright and relevant numbered operative sections 0.5–0.10 and chapters 1–6 compared with CTFLpractice lessons. Earlier mirror/search descriptions are historical access records. TheK2 white-box objectives require explanation; the source does not justify a categorical ban on small numeric illustrations that support explanation. Later Exam Rules 1.2§4.1.4 usesK2 for keyword definitions, while syllabus§0.5 usesK1; keep dated scopes distinct. No copied questions or figure assets.
- Market practice
Parallelism (Playwright documentation) ↗ — Microsoft (Playwright) · Says test files run in parallel by default, tests in one file run in order in one worker, each worker starts its own browser, a failed test discards the worker and its browser, and beforeAll runs again in the new worker (search excerpt, page not opened)
Found through a web search; the page was not opened (search excerpt, page not opened). Version: Web page, no edition number. Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Continuous Integration (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
- Market practice
How to fix Playwright shard imbalance and long-tail CI jobs? ↗ — WebCrawlerAPI glossary · Playwright sharding docs (--shard=x/y; fullyParallel splits by test) are registered. Whole-file sharding and empty shards come from a practitioner post (search excerpt, page not opened); Playwright issue 21195 itself could not be found by search, so the 'no tests found' wording is hedged ('may report'). Behaviour of --pass-with-no-tests with --shard NOT confirmed and not claimed.
Found through a web search; the page was not opened (search excerpt, page not opened). Licence terms were not read, so put it in your own words and do not quote it. Open the page and confirm what it says before relying on any detail.
- Market practice
Parallelism (Playwright documentation) ↗ — Microsoft (Playwright) · Reviewed 6 November 2026: Complete extracted primary article; examples inspected, not executed. See v45 source analysis for version scope and documented source ambiguities; no upstream run claimed.
Primary source opened and operative text inspected on 6 November 2026. Scope: Complete extracted primary article; examples inspected, not executed. Current live Playwright documentation reflects 1.65 where stated; explicit older examples retain their version. Source inspection is not an execution or compatibility-test claim. See the completed v45 Playwright analysis for source discrepancies and exact reading boundaries.
Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.