Software Development Magazine - Project Management, Programming, Software Testing |
Scrum Expert - Articles, tools, videos, news and other resources on Agile, Scrum and Kanban |
Precise Use Cases - Part 2
David Gelperin, LiveSpecs Software
5. A sample PUC
The following example is derived from a specification appearing in [22]. Additional examples can be found in [10].
Case Name: Get [new] Seat on Reserved Flight
Risk Factors: Frequency of occurrence: 0 to 2 times per reservation
Impact of failure: likely case - low, open seating is a workaround
worst case - medium, open seating in a large plane with many expensive seats is likely to anger important passengers
Case Conditions:
Invariants: None
Preconditions:For reservation system, status is active
For passenger, system access status is signed on
Interactions
Basic course:
Passenger |
Web-based Airline Reservation System
|
1. requests seat assignment |
2. requests a reservation locator
|
3. provides a (corrected) reservation locator alternative |
4. searches for reservation
|
Until (reservation located or all reservation locator strategies tried), repeat 3 to 4 |
|
5. offers seating alternatives, unless a. reservation not located or b. seat previously assigned or c. no seats are available or d. no seats are assignable |
|
6. selects a seating alternative |
7. assigns selected seat unless a. no seating alternative selected |
8. If (For reservation, seat previously assigned) Post-conditions -- For flight, previously assigned seat is available Endif |
|
9. confirms assignment SUCCESS EXIT |
Basic course Conditions
Invariants:
For reservation system, status is active
For passenger, system access status is signed on
For passenger & flight, a reservation exists and can be located
Pre-conditions:
For flight, some seats are assignable
Passenger wants to get or change seat assignment
Post-conditions:
For flight, seating alternative was selected
For reservation, selected seat is assigned
Alternative Courses:
Exception Handlers (EH):
EH 1 - 5a (reservation not located)
EH1 Invariants:
For reservation system, status is active
For passenger, system access status is signed on
For passenger, reservation not located
Passenger |
Web-based Airline Reservation System |
1. Offers help making reservation FAILURE EXIT |
EH 2 - 5b (seat previously assigned)
EH2 Invariants:
For reservation system, status is active
For passenger, system access status is signed on
For passenger & flight, a reservation exists and can be located
For reservation, seat previously assigned
Passenger |
Web-based Airline Reservation System |
1. offers to change seat assignment |
|
2. wants a. to change seat assignment b. no change |
3. If (Passenger wants to change seat assignment), CONTINUE Else, provides help and SUCCESS EXIT |
EH3 - 5c or 5d (no seats are available or assignable)
EH3 Invariants:
For reservation system, status is active
For passenger, system access status is signed on
For passenger & flight, a reservation exists and can be located
For flight, no seats are assignable
Passenger |
Web-based Airline Reservation System
|
1. If (check in),
Post-cond -- For passenger, name on standby list Else,
Endif FAILURE EXIT |
EH4 - 7a (no seating alternative selected)
EH4 Invariants:
For reservation system, status is active
For passenger, system access status is signed on
For passenger & flight, a reservation exists and can be located
For flight, some seats are assignable
For reservation, no seating alternative selected
Passenger |
Web-based Airline Reservation System
|
1. If (For reservation, seat previously assigned) SUCCESS EXIT Endif |
|
2. If (day of flight), advises to get assignment at check in Else, advises to try later Endif FAILURE EXIT |
Figure 1. Example of the reserved seat functionality in a web-based airline reservation system
6. Comments on the example
The use of explicit exception conditions assures that each exception handler has a visible point of origin. A point of origin is marked by an individual exception condition preceded by the keyword unless. For example in step 7 of the basic course, some alternative must be selected before the system can assign a seat. An exception handler must deal with the situation when no seat is selected. A point of origin may be in any course of action. In the example above, steps 5 and 7 in the basic course contain points of origin, while the exception handlers do not.
Precise use cases encourage the explicit identification of valid input alternatives. When there are only a few simple alternatives, they may be provided directly within the step as they are in the second step of exception handler 2. Otherwise, the alternatives should be specified in an associated glossary of input alternatives. The alternatives referenced in step 3 of the basic course would be found in such a glossary.
Methods & Tools Testmatick.com Software Testing Magazine The Scrum Expert |