Your suite needs to run in parallel across many workers. What do you change to make that safe?
What the interviewer wants to hear
- Remove shared mutable state and order dependencies
- Unique test data per test or worker
- Separate accounts or tenants for tests that change settings
- Thread-safe driver or fresh browser contexts
- Sharding across machines and merged reports
Model answer
First I find shared state. Tests that depend on running in order, static drivers, or global accounts all break in parallel. I give each test its own data from factories with unique ids, so two tests never fight over the same email or cart. Tests that change global settings get their own account or tenant per worker, or they are tagged to run serially. In Selenium I make sure each thread has its own WebDriver, for example with ThreadLocal; in Playwright each test already gets a fresh browser context. I then run the suite in random order a few times to flush out hidden dependencies. To scale beyond one machine, I shard the suite in CI and merge the reports so results are still in one place. Finally I check the environment can handle the extra load.
Can you answer it under time pressure?
Take a timed medium round and get scored on every answer.
More medium Automation Test Engineer questions
- How would you design a test automation framework from scratch for a web app?
- A test fails randomly in CI about 1 in 20 runs. Walk me through how you find and fix the cause.
- How do you manage test data in an automated suite that runs in parallel on shared environments?
- When should automated tests mock external services, and when should they use real ones?
- How do you make automated test results useful to developers and managers?
- How do you handle authentication in a large UI test suite without making every test log in through the UI?
- Describe how you would set up automated tests in a CI/CD pipeline for a web application.
- You are asked to load test a new checkout API before a big sale. How do you plan and run it?
- How would you approach test automation for a mobile app on Android and iOS?