Testing / Playwright Interview questions
What is the difference between sharding and parallel workers in Playwright?
Both spread work out for speed, but at different levels - one within a single machine, the other across multiple machines entirely.
| Parallel workers | Sharding |
| Multiple processes on one machine | Splitting the whole suite across separate machines/CI jobs |
| Configured via workers in config | Configured via --shard=index/total CLI flag |
| Limited by that machine's CPU cores | Limited only by how many CI runners you provision |
In practice they're combined: a CI pipeline might run 4 shards (--shard=1/4 through 4/4) on 4 separate runners, and each of those runners then also runs several parallel workers internally. Sharding is what lets a suite scale past the ceiling of a single machine's CPU count, which workers alone can't do.
Because each shard produces its own separate report, merging them into one combined HTML report afterward typically uses the blob reporter per shard followed by a merge-reports step, rather than trying to stitch plain HTML output back together manually.
More Related questions...