7 Use Cases
7 Use Cases
Engineering
7. Scenarios and Use Cases
Scenarios
Scenario
A scenario is a scene that illustrates some interaction with a proposed
system.
A scenario is a tool used during requirements analysis to describe a
specific use of a proposed system. Scenarios capture the system, as
viewed from the outside, e.g., by a user, using specific examples.
Note on terminology
Some authors restrict the word "scenario" to refer to a user's total
interaction with the system.
Other authors use the word "scenario" to refer to parts of the interaction.
In this course, the term is used with both meanings.
Describing a Scenario
3
Developing a Scenario with a Client
8. For the second question, the student chooses to edit a previous answer.
Student A chooses to delete a solution previously typed into the browser,
and to replace it with an attached file. [Can the student edit a previous
answer, or must it always be replaced with a new answer?]
9. As an alternative to completing the entire exam in a single session, Student A
decides to saves the completed questions to continue later. [Is this always
permitted?]
10..Student A logs off.
11. Later Student A log in, finishes the exam, submits the answers, and logs out.
[Is this process any different from the initial work on this exam?]
12. The Student A has now completed the exam. The student selects an option
that submits the exam to the grading system. [What if the student has not
attempted every question? Is the grader notified?]
Developing a Scenario with a Client (continued)
13. Student A now wishes to change a solution. The system does not
permit changes once the solution has been submitted. [Can the
student still see the solutions?]
14. Later Student A logins in to check the grades. [When are grades
made available? How does the student know?]
15. Student A requests a regrade. [What are the policies? What are the
procedures?]
Developing a Scenario with a Client (continued)
9
Scenarios for Analyzing Special Requirements
Models
Scenarios are useful in discussing a proposed system with a client, but
requirements need to be made more precise before a system is fully
understood.
This is the purpose of requirements modeling.
A use case provides such a model.
Borrow Book
BookBorrower
Record Pressure
PressureSensor
12
Actor and Use Case Diagram
Take Exam
ExamTaker
Check Grades
RequestR
Three separate egrade
use cases
Describing a Use Case
Set Exam
Instructor
Grade
Note that actor is a role. An
individual can be an ExamTaker
on one occasion and an
Instructor at a different time. Regrade
Relationships Between Use Cases: <<includes>>
Authenticate
<<includes>> is used for use cases that are in the flow of events of the
main use case.
<<extends>> is used for exceptional conditions, especially those that can
occur at any time.
Scenarios and Use Cases in the Development Cycle
Scenarios and use cases are both intuitive -- easy to discuss with
clients
Scenarios are a tool for requirements analysis.
• They are useful to validate use cases and in checking the design
of a system.
• They can be used as test cases for acceptance testing.
Use cases are a tool for modeling requirements.
• A set of use cases can provide a framework for the requirements
specification.
• Use cases are the basis for system and program design, but are
often hard to translate into class models.
Use Cases with Several Actors
<<includes>>
Order Food Order Wine
Waiter
Serve Food
Chef
Diner Cook Food
Eat Food
24
An Old Examination Question
Correct solution
<<includes>>
PaybyCredit
PlaceOrder
<<includes>>
Shopper
Is link is
optional IdentifyCustomer
An Old Examination Question
Wrong Solution
SearchMenu
AddtoCart
Pay <<includes>>
Shopper
PaybyCredit
<<includes>>
IdentifyCustomer