Use Case Testing | How To Perform Use Case Testing

As a software tester, it’s important to know how to properly execute use case testing.
This guide will teach you everything you need to know about this essential testing technique. Use case testing can help you uncover defects and potential problems with your software application.
By following the tips in this guide, you’ll be able to perform effective use case tests that will help ensure the quality of your software.
Before getting into what Use Case Testing is, let’s look at what Use Case in testing is and its components. From there we can understand what Use Case Testing is and how we can perform Use Case Testing.
What is Use Case in Testing
Use case is a method used to display how the user interacts with the system. It contains users’ actions and the response of the system for those user actions.
It is a diagram that represents the user’s interaction with the system. It helps in reducing the miscommunication between different teams in the project.
The business analyst writes the functional requirements after requirement gathering and analysis. Using use cases we can describe functional requirements.
What is Use Case Testing
Use case testing is a test case identifying technique used to cover the entire system. It helps us identify the gaps in the system that we may miss testing individual software components.
Use case testing helps to analyse the system on a transaction by transaction basis from start to finish,this gives better testing coverage.
It is commonly used for developing tests or systems at acceptable levels.
Who uses Use Case documents
A use case document helps us identify and understand where errors may occur during a transaction so we can resolve them.It is a set of possible sequences of interaction between the user(actor) and the system.
Use case documents are usually written by business analysts.Project managers, programmers, testers and other stakeholders use these use case documents.
It helps to have better communication and transparency about the requirements among stakeholders.
Types of Use Cases
The use cases are usually written in a narrative language describing the functional requirement.But there are two sides in the coin here, one the functional requirements from the user perspective and another being the requirements the system has to fulfil. Based on that there are two different types of uses cases:
- Business use case
- System use case
#1. Business Use Case
- Business use cases are about what the user expects from the system.
- We write business use cases at a high level, it is also known as abstract level use cases.
- It focuses on how the user achieves the goal with respect to the business operation.
- It provides meaningful, observable results as it defines the sequence of action the business performs.
#2. System Use Case
- The system use case is about what the system does.
- System use cases are at a low level, it is also known as implementation use cases.
- It is more detailed, referring to specific processes that different parts of the system perform to reach the goal of the end-users.
- It contains detailed functional specifications, such as dependencies, important internal supporting features and optional internal functionalities.
Elements in Use Cases
Depending on the depth and complexity of the scenario ,we can describe the use case can using the following elements.
- Actor: It refers to the user, it can be anyone who performs something in the system. It can be the customer, admin, vendor, delivery associate etc.
- System: It is a product, service or software under discussion.
- Goal: It is the successful user outcome.
- Stakeholder: It refers to a person who interacts to find out the behaviour of the system.
- Precondition: It is the condition the system needs to be before the workflow starts.
- Triggers: It is the event that initiates the use case..
- Main success scenario: It is the scenario in which nothing fails, it’s also known as basic flow.
- Alternative paths: It is a different path compared to the main scenario, here the system might achieve the goal through a different path or it can also fail, it is a variant from the basic scenario.
- Post condition: It is the condition which the system should have completed by the end of the steps.
How to Write a Use Case
Business analysts usually write the use cases based on the function requirements. You can follow the steps below to write a use case.
- Identify different users of the system and select a single user from it.
- Write out what that selected user wants to perform in the system.
- Each action taken by the user becomes a use case.
- Explain the basic action – what the user does and what the system does in response.
- Consider other paths where the goal is achieved but the scenario is different from the basic action.
- Consider every alternate path for the scenario where the system fails to bring the desired outcome.
- Identify common steps among these use case
- Collect those steps and note them down as a common course Use Case.
- Repeat the same steps for other users too.
Example of Use Case
In use cases we have scenarios and extensions for those scenarios. Let’s look at a simple example of ATM transactions.
Main success scenarios:
- Step #1: The actor enters the debit card into the system.
- Step #2: The system asks the user to enter the pin number.
- Step #3: The actor enters the valid pin number.
- Step #4: System prompts to withdraw page.
- Step #5: Actor enters valid amount.
- Step #6: The System dispenses cash
Alternate flow:
- Step #3a: User enters invalid pin number.
- Step #5a: User enters an invalid amount
Use Case Diagram
Use case diagrams are simple in nature and show the user, business and the workflow.Use case diagrams can summarise the interaction between the user(actor) and the system.
It sum up the system’s functionality using use cases, actors, and their relationships
An efficient use case diagram can help our team to communicate such details:
- Scope of the system
- The goal of the system which the user (actor) needs to achieve.
- The scenario in which the system interacts with users, organisations or other external systems.
Use case diagram

- System: The rectangle shape represents the system. It is the software system under discussion.
- Use Case: The oval shape represents the use case. It can be any action or activity.
- Actor: The stick figure represents the actor. It is the end-user of the system.
- Relationship:The arrow represents the relationship. It shows the system workflow.
Example:
Use case name: Cash Withdrawal from ATM
Actor: Customer
System: Bank, ATM machine
Pre-condition:
- The ATM is in working condition.
- The ATM has a sufficient cash balance.
- The customer should have a bank account in the corresponding bank.
- The customer should have a sufficient balance in their account.
Use case scenario:
Normal flow: Invalid pin number
4a. The user enters an invalid pin
- The system will return the card
- The use case ends with a failure outcome.
8a. The user has insufficient balance
- The system displays an error message about the insufficient balance
- The system will prompt to enter another cash amount
- Use cases would continue from the 7th step.
10a. Bank declined the transaction
- System returns the card
The use case ends with a failure outcome.

User Actions
User actions are the actions performed by the user in the system.
Let’s take an example of an eCommerce website. Here it can be
- Searching for a product.
- Selecting a product
- Adding items to the wishlist
- Adding it to the cart
- Checking out process
- Payment
- And more actions.
The above example shows the potential user actions from a customer perspective. When the user is a vendor, the interface and action would change. Similarly, if the user is an administrator, user actions will vary accordingly.
How to perform Use Case Testing
Use Case represents functional requirements and we know that each functional requirement needs to be tested. By performing the use case testing we can give proper coverage to those requirements.
Follow the steps below to perform use case testing.
- Step 1: Start by identifying the use-case scenarios.
- Step 2: Identify one or more test cases for each scenario.
- Step 3: Identify conditions that make the scenario execute, for each test case.
- Step 4: Add the data values to complete the test case
How to create Test Cases from Use Cases
To create a test case from a use case we use the above example of ATM withdrawal.
The test steps are the user actions and the expected results for those test steps are the system’s response.
Test Case #001: Valid flow where the customer provides valid pin number and cash amount
Steps:
- Insert debit card
- Enter the valid pin number
- Click on the cash withdrawal option
- Enter the valid cash amount
Expected results
- The system prompts for a PIN number
- The system displays a withdrawal option.
- The system prompts to enter the cash amount
- The system will dispense cash amount
Test Case #002: Invalid flow where the customer provides invalid pin number and cash amount
Steps:
- Insert debit card
- Enter the invalid pin number
Expected results
- The system prompts for a PIN number
- The system displays an invalid pin error and prompts to retry.
Test Case #003: Invalid flow where the customer provides valid pin number but invalid cash amount
Steps:
- Insert debit card
- Enter the valid pin number
- Click on the cash withdrawal option
- Enter the invalid cash amount
Expected results
- The system prompts for a PIN number
- The system displays a withdrawal option.
- The system prompts to enter the cash amount
- The system will prompt an error message saying insufficient balance and prompt to enter another amount.
Characteristics of Use Case Testing
- It captures the interaction between the user and the system.
- In Use Case, we refer to the user as an actor, hence we can identify each interaction of the actor.
- We refer to Test cases based on use cases as scenarios.
- It helps us identify defects in integration testing that we missed during unit testing of individual components.
- With use case testing we have the ability to find out gaps in our coverage.
- It is very efficient in acceptance tests as it clearly defines the scalp.
- It tests the quality of the testing rather than testing the quality of the product.
Advantages of Use Case Testing
- Use case testing is completely focused on the user’s perspective, thus working on creating a quality product for the user.
- It can be helpful to identify issues related to user experience.
- It helps us to cover all the possibilities in which the actor (user) might use the system.
- It can reduce the complexity of the test cases as the testing team will follow the flows given in the use case document.
- It facilitates a better understanding within the team due to its easy format.
- It is helpful in identifying dubious, unseen, usually ignored functionality in the application.
Disadvantages of Use Case Testing
- Even if a single flow is missing in the document, it can affect the quality of the test cases.
- It only covers functional requirements of the software, it completely leaves out non-functional requirements.
- Sometimes the scenario inside the system might involve another system, not just the user. We won’t be considering those cases, making the coverage incomplete.
Conclusion
To summarise, we can say that use case testing mainly focuses on creating test cases that would cover the functional requirements. It helps us discover all the possibilities in the transaction and helps us identify the gaps in our understanding. Use cases that are developed for implementing are not exhaustive and they are written at a high level for stakeholders understanding. The details in the use case might be insufficient for testing.