Computers

Difference between Use Case and Test Case?

Difference between Use Case and Test Case?

In this tutorial, let’s understand the difference between a Use case and a test case. In software development and testing, both use cases and test cases are important tools used to describe and validate how a system behaves.

Testcases are written with an intent to test the system under test with expected results. Testcases showcase the viewpoint of a tester of the system. They can be positive/ negative and even the internal functions of the system.

Use Case

A use case is a description of how a user interacts with a system to achieve a specific goal. It represents a real-world scenario that describes the functional requirements of the system. Use cases showcase the viewpoint of the use case actor. They only deal with the external interface functions of the system. Use cases are generally written by business analysts or system designers and focus on what the system should do from a user’s perspective.

Use case document contains descriptions of the actor’s Steps/Actions achieving the business goal using the system. Use case document contains actors, stakeholders, pre-conditions, and the steps to achieve the business goal.

Sample UML diagram

Sample use cases of a Bank customer represented in an UML diagram.

 

Bank Customer ATM Use Cases

Sample Use Case

ATM Cash Withdraw Use Case:

ATM Cash Withdraw Use Case

Test Case

A test case is a set of conditions or steps used by testers to verify whether a particular feature or function of the software application is working as expected.

A Test Case is a document that contains the Steps/Actions executed by the tester to verify the different functions of the System/Application under test. 

A test case contains preconditions,  Test execution steps, Test Data, Expected results, Actual results, Test execution Status, etc. Tester fills the Actual Results and Execution Status after executing the test case. Test cases are written by testers and focus on how to test the system based on requirements and use cases.

Use Case vs Test Case

Use Case Test Case
Purpose Describes how a user interacts with the system Validates that the system works as expected
Written By Business Analyst or System Designer Software Tester or QA Engineer
Focus User’s goals and system behavior Test conditions, inputs, and outputs
Level of Detail High-level scenario-based description Step-by-step test procedure
Structure Includes actors, preconditions, main flow, alternate flow Includes test steps, test data, expected and actual results
Example User logs into a banking app to check balance Enter username/password and verify the balance is displayed