Playwright · Senior · Question 66 of 77
How do you make sure tests don't depend on run order?
- 1Run with
fullyParalleland random sharding regularly - 2Use
mode: 'serial'in all describe blocks - 3Name tests alphabetically so the order is always fixed
Show the answer
Correct answer: Run with fullyParallel and random sharding regularly
Explanation
If tests only pass in one order, they share state. Running them in parallel and in different groupings exposes that.