How would you design reliable parallel execution on a browser grid?
Answer
Make each test independent with isolated accounts, data, downloads and browser state; declare capabilities explicitly and avoid ordering assumptions. Shard by measured duration, cap concurrency to grid and backend capacity, and preserve per-session logs, video, screenshots and network evidence. Distinguish product failures from grid capacity, browser startup and infrastructure failures in reporting.
Strong answer includes
- isolates state and data per worker
- matches concurrency to grid and system capacity
- separates infrastructure failures from product failures
Practical example
Doubling worker count in Selenium Grid from 20 to 40 caused the failure rate to spike from 2% to 30%; the culprit was the backend's connection pool, not the grid, so the fix was capping concurrency at 25 and adding retry-with-backoff for pool-exhaustion errors instead of adding more grid nodes.