Just showing the use case diagram in UML notation is not enough. Each use case accompanied by text explaining the purpose of the use case as well as what functionality is accomplished when a use case is executed.
The use case specification is typically created in analysis and design phase in an iterative manner.
- At first, only a brief description of the steps needed to carry out the normal flow of the use case (i.e., what functionality is provided by the use case) is written.
- As analysis progresses, the steps are fleshed out to add more detail.
- Finally, the exceptional flows are added to the use case
- Each project can adopt a standard use case template for the creation of the use case specification.
Use Case vs Use Case Specification
A Use Case describes a task that is performed by an actor yielding a result of business value for a business. A use case may be visualized as a use case diagram or/and in structured textual specification format:
Use Case (task - a customer want to perform) may be:
- Interactive - A system use case describes an actor's interaction with a system in pursuit of the defined business goal
- Manual - A sequence of actions performed by an actor
- Automated - A sequence of steps performed by a program or script
Characteristics of Use Cases
A use case has:
- Only one goal
- A single starting point
- A single ending point
- Multiple paths for getting from start to finish
- i.e. Specify behavior for a variety of possible conditions
- Each conditions may require specific action(s)
For Example - Customer pays bill:
There are multiple paths to achieve the goal:
- Telephone payment
- By mail
- In person
- by check
- by cash, etc.
A path that does not lead to the goal:
Agile Use Case Approach
The use case model and its individual use cases evolve level by level over time. Not all use cases of a model will necessarily need to be specified to the same level of detail.
Just-in-Time and Just-Enough
Use cases can be written at differing levels of data and scope, each serves a purpose:
- Summary: General descriptions and sweeping overviews of system functionality or business processes.
- User Level : Task-related descriptions of users and how they interact with the system; descriptions of a specific business process. User-Level use cases are usually considered to be at the level of task that is the main work of the user.
For example: getting cash out of the ATM machine is a useful task and would be a use case at the core level, but entering your PIN number would not be at this level, because it supports the main work.
- Sub-function: Descriptions of lower-level activities that are used to complete subparts of a core use case.
Note: Some use cases may be sufficiently specified up to level II. You stop when sufficient detail is achieved using just-in-time and just-enough manner.
A Detailed Use Case Specification
The detailed use case is a textual representation illustrating a sequence of events together with other related use case information in certain format. People typically adopt a standard use case template for recording the detailed information for the use cases
Use Case Template - ATM withdraw case example
As mentioned before, there are several notation styles for use cases (e.g. diagram style, unified modeling language, textual format). Whatever notation is used should be easy to understand. You can use templates, like the ones from Alistair Cockburn, but it is also an option to use what fits best for your team.
Use Case Specification |
|
Use Case Name: |
Withdraw Cash |
Actor(s): |
Customer (primary), Banking System (secondary) |
Summary Description: |
Allows any bank customer to withdraw cash from their bank account. |
Priority: |
Must Have |
Status: |
Medium Level of details |
Pre-Condition: |
The bank customer has a card to insert into the ATM
The ATM is online properly |
Post-Condition(s): |
- The bank customer has received their cash (and optionally a receipt)
- The bank has debited the customer's bank account and recorded details of the transaction
|
Basic Path: |
- The customer enters their card into the ATM
- The ATM verifies that the card is a valid bank card
- The ATM requests a PIN code
- The customer enters their PIN code
- The ATM validates the bank card against the PIN code
- The ATM presents service options including "Withdraw"
- The customer chooses "Withdraw"
- The ATM presents options for amounts
- The customer selects an amount or enters an amount
- The ATM verifies that it has enough cash in its hopper
- The ATM verifies that the customer is below withdraw limits
- The ATM verifies sufficient funds in the customer's bank account
- The ATM debits the customer's bank account
- The ATM returns the customer's bank card
- The customer takes their bank card
- The ATM issues the customer's cash
- The customer takes their cash
|
Alternative Paths: |
- 2a. Invalid card
- 2b. Card upside down
- 5a. Stolen card
- 5b. PIN invalid
- 10a. Insufficient cash in the hopper
- 10b. Wrong denomination of cash in the hopper
- 11a. Withdrawal above withdraw limits
- 12a. Insufficient funds in customer's bank account
- 14a. Bank card stuck in machine
- 15a. Customer fails to take their bank card
- 16a. Cash stuck in machine
- 17a. Customer fails to take their cash
- a ATM cannot communicate with Banking System
- b Customer does not respond to ATM prompt
|
Business Rules: |
- B1: Format of PIN
- B2: Number of PIN retries
- B3: Service options
- B4: Amount options
- B5: Withdraw limit
- B6: card must be taken away before dispense of cash
|
Non-Functional Requirements: |
- NF1: Time for complete transaction
- NF2: Security for PIN entry
- NF3: Time to allow collection of card and cash
- NF4: Language support
- NF5: Blind and partially blind support
|