How do you derive test cases from a use case?
Test designJunior
In shortI write one test for the main success scenario, at least one for every alternative and exception flow, and I check the postconditions, not just the final screen. Coverage is the share of flows tested.
Model answer
A use case describes how an actor reaches a goal: preconditions, the main success scenario (happy path), alternative flows (other routes that still reach the goal), exception flows (errors that stop the normal path) and postconditions (what must be true afterward).
My steps
- List every flow. For “Reorder a previous order”: the main flow, “some dishes sold out”, “prices changed”, “restaurant closed”, “card declined” and so on.
- One test per flow, at least. For an alternative, I follow the branch and check it rejoins the main flow. For an exception, I check the message, that nothing half-finished is left, and whether the user can recover.
- Preconditions become setup. “Customer has a completed order” is test data, not a step.
- Postconditions become expected results. After a successful reorder: one new order, charged once, the original order unchanged. A nice confirmation screen isn’t enough.
- Use other techniques inside steps. Boundary values for a quantity, state transitions for an order status.
- Look for missing flows. “What if every dish is sold out?” If the use case doesn’t say, I raise it as a gap rather than guessing.
Coverage is flows tested divided by all flows. Ten variations of the happy path still cover one flow.
Learn more: Use Case Testing
What they're looking for
Knowing the parts of a use case (actor, preconditions, main flow, alternative and exception flows, postconditions), one test per flow, checking postconditions, and raising missing flows as gaps.
Common mistakes
- Testing only the happy path.
- Treating preconditions as test steps instead of setup.
- Inventing expected results for flows the use case doesn't describe.
More test design questions
- What is the difference between a test case and a test scenario?Junior
- What is the difference between positive and negative testing?Junior
- Explain equivalence partitioning and boundary value analysis using an age field that accepts 18 to 60.Junior
- What is exploratory testing, and when would you use it?Junior