How do you manage test data in an automated suite that runs in parallel on shared environments?
What the interviewer wants to hear
- Create data per test via APIs or factories
- Unique identifiers to avoid collisions
- Clean up after tests or use disposable environments
- Avoid dependence on pre-existing manual data
- Seed reference data and keep secrets safe
Model answer
My rule is that each test creates the data it needs and does not depend on anything someone created by hand. I use factory functions that call the API or database to create users, products or orders, with unique values like a UUID or timestamp in emails and names, so parallel workers never collide. Fixtures handle setup and teardown: they create the data before the test and delete it after, or the data is tagged so a nightly job cleans it. Stable reference data, like countries or product categories, is seeded once per environment by a script in version control. For heavy integration tests I prefer disposable environments, such as Testcontainers or a fresh preview environment per branch. I keep credentials in CI secrets. This makes tests independent of order and safe to run in parallel.
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.
- 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?
- Your suite needs to run in parallel across many workers. What do you change to make that safe?
- 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?