use case

A use case is a methodology used in system analysis to identify, clarify and organize system requirements. The use case is made up of a set of possible sequences of interactions between systems and users in a particular environment and related to a particular goal. The method creates a document that describes all the steps taken by a user to complete an activity.

Use cases are typically written by business analysts and can be employed during several stages of software development, such as planning system requirements, validating design, testing software and creating an outline for online help and user manuals. A use case document can help the development team identify and understand where errors may occur during a transaction so they can resolve them.

Every use case contains three essential elements:

  • The actor. The system user -- this can be a single person or a group of people interacting with the process.
  • The goal. The final successful outcome that completes the process.
  • The system. The process and steps taken to reach the end goal, including the necessary functional requirements and their anticipated behaviors.

Characteristics of use case

Use cases describe the functional requirements of a system from the end user's perspective, creating a goal-focused sequence of events that is easy for users and developers to follow. A complete use case will include one main or basic flow and various alternate flows. The alternate flow, also known as an extending use case, describes normal variations to the basic flow as well as unusual situations.

A use case should display the following characteristics:

  • Organizes functional requirements.
  • Models the goals of system/actor interactions.
  • Records paths -- called scenarios -- from trigger events to goals.
  • Describes one main flow of events and various alternate flows.
  • Multi-level, so that one use case can use the functionality of another one.

How to write a use case

There are two different types of use cases: business use cases and system use cases.

A business use case is a more abstract description that's written in a technology-agnostic way, referring only to the business process being described and the actors that are involved in the activity. A business use case identifies the sequence of actions that need to be performed by the business to provide a meaningful, observable result to the end user.

On the other hand, a system use case is written with more detail than a business use case, referring to the specific processes that must happen in various parts of the system to reach the final user goal. A system use case diagram will detail functional specifications, including dependencies, necessary internal supporting features and optional internal features.

When writing a use case, the design scope should be considered to identify all elements that lie within and outside the boundaries of the processes. Anything essential to the use case that lies outside its boundaries should be indicated with a supporting actor or by another use case. The design scope can be a specific system, a subsystem or the entire enterprise. Use cases that describe business processes are typically of the enterprise scope.

As mentioned, the three basic elements that make up a use case are actors, the system and the goal. Other additional elements to consider when writing a use case include:

  • Stakeholders, or anybody with an interest or investment in how the system performs.
  • Preconditions, or the elements that must be true before a use case can occur.
  • Triggers, or the events that cause the use case to begin.
  • Post-conditions, or what the system should have completed by the end of the steps.

The use case is written using narrative language, describing the functional requirements of a system from the end user's perspective. A use case diagram is created using a unified modeling language, with each step represented by its name in an oval; each actor represented by a stick figure with their name written below; each action indicated by a line between the actor and step; and the system boundaries indicated by a rectangle around the use case.

Use case methodology

The writing process includes:

  1. Identifying all system users and creating a profile for each one. This includes every role played by a user who interacts with the system.
  2. Selecting one user and defining their goal -- or what the user hopes to accomplish by interacting with the system. Each of these goals becomes a use case.
  3. Describing the course taken for each use case through the system to reach that goal.
  4. Considering every alternate course of events and extending use cases -- or the different courses that can be taken to reach the goal.
  5. Identifying commonalities in journeys to create common course use cases and write descriptions of each.
  6. Repeating steps two through five for all other system users.

When writing a use case, developers may use a sequence diagram -- which shows how objects react along a timeline -- to model the interactions between objects in a single use case. Sequence diagrams allow developers to see how each part of the system interacts with others to perform a specific function as well as the order in which these interactions occur to complete a use case.

Benefits of use case

A single use case can benefit developers by revealing how a system should behave while also helping identify any errors that could arise in the process.

Other benefits of use case development include:

  • The list of goals created in the use case writing process can be used to establish the complexity and cost of the system.
  • By focusing both on the user and the system, real system needs can be identified earlier in the design process.
  • Since use cases are written primarily in a narrative language they are easily understood by stakeholders, including customers, users and executives -- not just by developers and testers.
  • The creation of extending use cases and the identification of exceptions to successful use case scenarios saves developers time by making it easier to define subtle system requirements.
  • By identifying system boundaries in the design scope of the use case, developers can avoid scope creep.
  • Premature design can be avoided by focusing on what the system should do rather than how it should do it.

In addition, use cases can be easily transformed into test cases by mapping the common course and alternate courses and gathering test data for each of the scenarios. These functional test cases will help the development team ensure all functional requirements of the system are included in the test plan.

Furthermore, use cases can be used in various other areas of software development, including project planning, user documentation and test case definitions. Use cases can also be used as a planning tool for iterative development.

Use case vs. user story

While both a use case and a user story are used to identify system users and describe their goals, the two terms are not interchangeable; they serve different purposes. While a use case is more specific and looks directly at how a system will act, a user story is an Agile development technique that focuses on the result of the activities and the benefit of the process being described.

More specifically, the use case -- often written as a document -- describes a set of interactions that occur between a system and an actor to reach a goal. The user story will describe what the user will do when they interact with the system, focusing on the benefit derived from performing a specific activity.

In addition, user stories are often less documented than use cases and deliberately neglect important details. User stories are primarily used to create conversations by asking questions during scrum meetings, whereas use cases are used by developers and testers to understand all the steps a system must take to satisfy a user's request.

Examples of use case

Outside of software and systems development, an example that can be used to explain uses cases is driving directions.

A driver is looking to get from Boston to New York City. In this scenario, the actor is the driver, the goal is getting to New York and the system is the network of roads and highways they will take to get there. There is likely one route that is the most commonly taken by drivers between Boston and New York -- this is the common course use case. However, there are various detours that can be taken off this route that will still eventually lead the driver to New York City. These detours and different routes are the extending use cases. The goal of the driving directions is to identify each turn and highway exit the driver must take to reach their final destination.

More specifically related to software and system development, a use case can be used to identify how a customer completes an order through an online retailer. First, the use case must be named, and the actors must be identified. In this scenario, the use case will be called "complete purchase" and the actors are:

  • the customer;
  • the order fulfillment system; and
  • the billing system.

Next, the triggers, preconditions and post-conditions are defined. In this case, the trigger is the customer indicating that they would like to purchase their selected products. The precondition for the use case is the customer selecting the items they eventually want to buy. The post-conditions include the order being placed; the customer receiving a tracking ID for their order; and the customer receiving an estimated delivery date for their order.

Once the title, actors, triggers, preconditions and post-conditions are identified, the basic flow -- or common course use case -- can be outlined, starting with the customer indicating they want to make a purchase and ending with the customer exiting the system after receiving confirmation that their order has been placed. After the normal flow is written, all extending use cases should be detailed, recorded and included in the document.

This was last updated in February 2020

Continue Reading About use case

Dig Deeper on Software project management