All jobs / Automation developer / Automation Fundamentals
Automation developer interview question · 0–1 years
Test B fails when you run it after test A, and passes alone. What is wrong?
The strongest answer
Shared leftover state — a cookie, a row, a cart — tests must set up and leave the world as they found it, or use data only they own
Why it works
Exactly. Isolation is the job. Order dependence is a bug in the suite.
What a good answer covers
- Own your data and session.
- Order dependence is a defect.
- Do not freeze run order.
- Do not merge tests to hide coupling.
Answers that fall short
- Close, but not the strongest: The runner is broken; order should never matter so I ignore it
The runner is telling you the truth. - Weak: I lock the file so A always runs first
A fixed order dies the day you parallelise. - Red flag: I merge A and B into one long test so the order is “documented”
A mega-test hides two stories and still shares state.
Who gets asked this
More Automation Fundamentals questions
- A junior’s test is 80 lines of clicks with one expect at the end. What do you ask for?
- A test only checks that the page did not throw. What is missing?
- A UI test fails one in four CI runs. What is it?
- A PR adds a test that Playwright can click a native checkbox. What do you say?
- A test logs in, updates the profile, buys, refunds, and checks the invoice PDF. What do you do?
- A new date-parsing helper is wrong on leap days. Where does the first test go?
- How do you debug a flake that only happens in CI?
- The framework offers retries: 2 on every test. When do you use it?