usability.gov

Bookmark and Share     Font Size Reduce Text Size Enlarge Text Size     Print Print     Download Reader PDF

Use Cases

Introduction

A use case in software engineering is a description of a system’s behavior as it responds to a request that comes from outside the system. Use cases describe the system from a user’s point of view. Use cases describe the interaction between a primary actor (the initiator of the action) and the system itself. It is represented as a sequence of simple steps.

Each use case focuses on describing how to achieve a goal or task. A use case should:

  • Describe what the system shall do to assist the actor in achieving a goal
  • Does not include any implementation-specific language
  • Not include any details about the user interfaces or screens.

For example, this use case describes a simple login.

  1. System prompts the user to log on.
  2. User enters username and password.
  3. System verifies the logon information.
  4. The system logs user on to the system.

Parts of a Use Case

Roles

Actor – anyone or anything that performs a behavior (who is using the system)

Stakeholder – someone or something with vested interests in the behavior of the system under discussion (SUD)

Primary Actor – stakeholder who initiates an interaction with the system to achieve a goal

Terminology

Preconditions – what must be true or happen before and after the use case runs.

Triggers – this is the event that causes the use case to be initiated.

Main success scenarios – use case in which nothing goes wrong.

Alternative paths – these paths are a variation on the main theme. These exceptions are what happen when things go wrong at the system level.

Value of Use Cases

Use cases add value because they tell coherent stories about how the system will behave in use. They provide a list of goals and this list can be used to establish the cost and complexity of the system. Project teams can then negotiate which functions get built. They also help in brain storming all the things that could go wrong in successful scenarios.

A Laundry Example

I know this may appear confusing to you but let’s go through a simple sets of use cases in an area that we probably are all too familiar with: laundry. We will demonstrate a simple, middleweight and heavyweight use case for doing the laundry.

In each of these types of uses cases you will see that:

  • The maid does laundry on a Wednesday
  • She washes each load.
  • She dries each load.
  • She folds certain items.
  • She irons some items.
  • She throws away certain items.

Simple Laundry Use Case

Use Case 1

Do laundry

Actor

Maid

 

On Wednesdays the maid reports to the laundry room.  She sorts the laundry that is there.  Then she washes each load.  She dries each load. She folds the items that need folding.  She irons and hangs the items that are wrinkled.  She throws away any laundry item that is irrevocably shrunken, soiled or scorched.

Middleweight Laundry Use Case

Use Case 1

Do laundry

Actor

Maid

Basic Flow

On Wednesdays the maid reports to the laundry room.  She sorts the laundry that is there.  Then she washes each load.  She dries each load. She folds the items that need folding.  She throws away any laundry item that is irrevocably shrunken, soiled or scorched.

Alternative Flow

If she notices that something is wrinkled, she irons it and then hangs it on a hanger.

Alternative Flow

If she notices that something is still dirty, she rewashes it.

Alternative Flow

If she notices that something shrank, she throws it out.

Heavyweight Laundry Use Case

Use Case 1

Maid does laundry

Actor

Maid

Use Case Overview

It is Wednesday and there is laundry in the laundry room.  The maid sorts it, then proceeds to launder each load.  She folds the dry laundry as she removes it from the dryer.  She irons those items that need ironing. 

Subject Area

Domestics

Actor(s)

The maid

Trigger

Dirty laundry in the laundry room on Wednesday.

Precondition 1

It is Wednesday

Precondition 2

There is laundry in the laundry room.

Flows

Basic Flow

Do laundry

Description

This scenario describes the situation where only sorting, washing and folding are required.  This is the main success scenario.

1

Maid sorts laundry items.

2

Maid washes each load.

3

Maid dries each load.

4

Maid verifies that laundry item does not need ironing, is clean and not shrunken.

5

Maid verifies that laundry item is foldable.

6

Maid folds laundry item

7

Maid does this until there are no more laundry items to fold

Termination outcome

Laundry is clean and folded

Alternative Flow 4a

Laundry item needs ironing

Description

This scenario describes the situation where one or more items need ironing before or in lieu of folding

4a1

Maid verifies that the laundry item needs ironing and is clean and not shrunken

4a2

Maid irons the laundry item

4a3

Maid puts laundry item on a hanger

Termination outcome

Laundry that needs ironing is ironed and hung up.

Alternative flow  4b

Laundry item is dirty

Description

This scenario describes the situation where the laundry item did not get clean the first time through the wash.

4b1

Maid verifies that the laundry item is not clean.

4b2

Maid rewashes the laundry item

Termination outcome

Dirty laundry is rewashed.

Alternative flow 4c

Laundry item shrank.

Description

This scenario describes the situation where the laundry item shrank.

4c1

Maid verifies that the laundry item shrank

4c2

Maid disposes of laundry item.

Termination outcome

Laundry item no longer exists.

Alternative flow 5a

Laundry item needs hanger

Description

This scenario describes the situation where the laundry item needs to be hung instead of folded.

5a1

Maid verifies that laundry item needs hanging.

5a2

Maid puts laundry item on a hanger.

Termination outcome

Laundry that needs hanging is hung up.

Post conditions

All laundry clean and folded or hung up.

Business Rules

  1. Laundry can only be done on Wednesdays.
  2. All ironed laundry items get hung on hangers
  3. Any laundry item that is irrevocably soiled, shrunken, scorched, etc., gets thrown out.

 

I hope that was clear. Now let’s look at another example. This is a web application that allows user to log into the system, search for jobs, and create a search agent.

A Login, Search and Setup Search Agent Example

Login

  1. Log in to Jobs application
  2. Log in to Jobs application fails

USE CASE 1.1

Login to System

Use Case Overview

User logs in to Jobs application to access the application functions (e.g., search for jobs, apply to jobs, or create search agents)

Subject Area

Manage Jobs application use

Actor(s)

General users, managers, users with managerial authority, system administrators

Trigger

User wants to access Jobs application.

Precondition 1

User has access to the internet.

Precondition 2

User has a user name and password

 

Flows

Basic Flow

Log in to Jobs application

Description

This flow describes the situation in which the user with a valid username and password wants to access Jobs application functions.

1

User selects Jobs application from company intranet home page

2

System displays logon screen

3

User enters username and password and submits to system

4

System displays Jobs application home page

Termination outcome

User can perform any action according to their authorization.

 

Alternative Flow 1a1

Log in fails

Description

The flow describes the situation in which a user with a valid id and password enters incorrect information and cannot log on to Jobs application.

1a1

User selects Jobs application from company intranet home page

1a2

System displays logon screen

1a3

User enters username and password and submits to system

1a4

System unable to validate and displays error message

Termination outcome

User not logged in and system displays error message. Error message contains information on how to recover id/password information.

 

Post conditions

User is logged into system and depending on authority can search and apply for jobs, view application history, create search agents, create new requisitions, work with existing requisitions, work with applicants, disposition candidates, perform administrative functions.

Business Rules

  1. User has a company username and password
  2. The Jobs help desk will provide id and password assistance to users to recover lost information.
  3. Roles will be validated upon sign on.

 

Search for Jobs

  1. Users searches for jobs
  2. No jobs matching search criteria
  3. System aborts operation

 


USE CASE 1.2

Search for Jobs

Use Case Overview

User wants to search for jobs matching search criteria.

Subject Area

Search for jobs

Actor(s)

General users, managers, users with managerial authority, system administrators

Trigger

User wants to search for jobs.

Precondition 1

User is logged in to the Jobs application.

 

Flows

Basic Flow

User searches for jobs

Description

This flow describes the situation in which the user wants to search for jobs matching selected criteria.

1

User selects search from the left navigation menu

2

System displays search screen

3

User enters or selects all required and any optional criteria and submits the search to the system.

4

System displays matching jobs.

Termination outcome

Matching jobs displayed.

 

Alternative Flow 2a1

No jobs matching search criteria

Description

The flow describes the situation in which a user submits a job search to the system but there are no matching jobs in the system.

2a1

User selects search from left navigation menu

2a2

System displays search screen

2a3

User enters or selects all required and any optional search criteria and submits the search to the system.

2a4

System unable to find matching jobs and displays no matches found message.

Termination outcome

No matching jobs displayed. User has option to change search criteria and submit a new search.

 

Post conditions

System is available.

Business Rules

 

 

Alternative Flow 2b1

System aborts during search

Description

The flow describes the situation in which a user submits a job search to the system but the system aborts during the search.

2b1

User selects search from left navigation menu

2b2

System displays search screen

2b3

User enters or selects all required and any optional search criteria and submits the search to the system.

2b4

System aborts during search process.

Termination outcome

System displays error message.

 

Post conditions

System unavailable but displays error message and error code for reference to help desk.

Business Rules

  1. System will display an error message and error code for reference purposes
  2. Help desk contact information will be displayed with message
  3. System will save the search criteria and user will have the option to use these criteria on next log on.

 

Create a Search Agent

  1. Users searches for jobs and selects to save criteria as search agent.
  2. User attempts to save search using existing search name.
  3. No matching jobs but search agent created.

 


USE CASE 1.3

Create search agent

Use Case Overview

User wants to save search criteria as a search agent that returns a list of matching jobs to their company e-mail on a daily basis. 

Subject Area

Create search agent

Actor(s)

General users, managers, users with managerial authority, system administrators

Trigger

User wants to save search criteria as search agent. 

Precondition 1

User is logged in to the Jobs application.

 

Flows

Basic Flow

User saves search criteria as search agent.

Description

This flow describes the situation in which the user wants to search for jobs matching selected criteria and save search criteria as a search agent.

1

User selects search from the left navigation menu

2

System displays search screen

3

User enters or selects all required and any optional criteria and selects to save the search criteria as a search agent and to run the search at the current time.

4

System prompts user for search agent name.

5

User enters a search agent name and saves the name to the system.

6

System displays search agent saved message and matching search results.

Termination outcome

Matching jobs displays matching search results and saves the search agent to the system. Batch job will run every 24 hours and return matching jobs to the user’s company e-mail address. Search agent is available to view criteria, edit criteria, or delete agent.

 

Alternative Flow 3a1

No matching jobs displayed but search agent created.

Description

The flow describes the situation in which a user submits a job search to the system and saves criteria as search agent but there are no matching jobs in the system at the current time.

3a1

User selects search from left navigation menu

3a2

System displays search screen

3a3

User enters or selects all required and any optional search criteria and selects to save the search criteria as a search agent and to a run the search at the current time.

3a3

System prompts user for search agent name.

3a4

User enters a search agent name and saves the name to the system

3a5

System displays search agent saved message and displays no matches found message

Termination outcome

No matching jobs displayed. User has option to change search criteria and submit a new search, edit the search agent and resubmit search.

 

Post conditions

Search agent results will be returned to the user’s e-mail account on a daily basis. Matching jobs displayed.

Business Rules

  1. User can create up to 20 search agents.
  2. System will run a batch job process every 24 hours and return any matching jobs to the user’s company e-mail account.<</li>

 

Alternative Flow 3b1

Search agent name already exists.

Description

The flow describes the situation in which a user submits a job search to the system and saves criteria as search agent but the search agent name is duplicative.

3b1

User selects search from left navigation menu

3b2

System displays search screen

3b3

User enters or selects all required and any optional search criteria and selects to save the search criteria as a search agent and to a run the search at the current time.

3b3

System prompts user for search agent name.

3b4

User enters a search agent name and saves the name to the system

3b5

System displays error message stating that search agent already exists.

Termination outcome

Search agent not saved.

 

Post conditions

Search agent not saved. System will display error message and prompt user to change the search name or replace existing search agent with the newly created search agent.

Business Rules

  1. System will not allow user to save the search agent as the same name as existing search agent without notifying user of duplication.

 

 

Template for your Use Case


USE CASE #

<the name is the actor goal as short active verb phrase>

Use Case Overview

<brief description of use case>

Subject Area

<system or system component>

Actor(s)

<the entity that communicates with the system>

Trigger

<the action that starts the use case>

Precondition 1

<what must be true before the use case can be initiated>

Precondition 2

 

Precondition n

 

 

Flows

Basic Flow

<name of basic flow>

Description

<description of basic flow here>

1

<action>

2

<action>

3

<action>

 

 

Termination outcome

<what happens when this flow is over?>

 

Alternative Flow #a

<name of alternate flow>

Description

<description of alternative flow here>

#a1

<action>

#a2

 

Termination outcome

<what happens when this flow is over?>

 

Post conditions

<description of state of system once flow ends>

Business Rules