Run a practical lab
How would you choose a locator?
Start with how a user identifies the control. A role and accessible name can describe intent better than a long DOM selector. Confirm the locator uniquely identifies the intended element; test IDs can be useful when a stable explicit contract is needed.
Why does clicking a button not prove success?
The action only initiates behaviour. Verify the business outcome: for example, the correct order total and confirmation. Choose assertions that would fail if the user-visible requirement was broken.
What should a fixture provide?
A fixture supplies a test dependency and can own its setup and cleanup. In a shopping project, consider preparing predictable customer data while keeping tests independent. Shared mutable data can make results depend on execution order.
How do you investigate a flaky test?
Compare a failed run with the intended behaviour. Use trace evidence to inspect actions, page state and network activity. Consider unstable data, application timing and ambiguous locators. Retries alone do not explain or remove a defect.
When would you use an API check?
API testing can check a service directly or establish test preconditions. Browser checks answer different questions about the user interface. Choose both when the risk spans service behaviour and the customer journey.
Official references
Use these sources for current API behaviour and setup requirements. SPOTHUB is an independent training provider.
