Test Design
Use Case Testing
Designing tests based on use cases that describe how users interact with the system to achieve goals.
Full definition
Use case testing designs tests based on use cases — descriptions of how actors (users) interact with the system to achieve specific goals. Each use case includes a main success scenario and alternative/error scenarios.
Use case structure:
- Actor: Who performs the action (e.g., registered user)
- Precondition: What must be true before starting
- Main flow: The happy path (steps to achieve the goal)
- Alternative flows: Different paths to success
- Exception flows: Error/failure paths
- Postcondition: The state after completion
Example — 'Purchase Course':
- Actor: Registered student
- Precondition: Student is logged in, course is published
- Main flow: Browse → Select → Add to cart → Checkout → Payment → Confirmation
- Alt flow 1: Student already owns course → Show 'Already enrolled'
- Alt flow 2: Student has a coupon → Apply discount
- Exception 1: Payment fails → Show error, allow retry
- Exception 2: Course sold out → Show waitlist option
Each flow becomes one or more test cases. Use case testing ensures you test the system from the user's perspective, covering both happy and unhappy paths.