How to Write Test Cases - Software Testing
Last Updated :
23 Jul, 2025
Writing effective test cases is a critical skill in software testing, ensuring that the software meets the desired functionality and quality standards. A well-written test case provides clear instructions to verify specific features of the software and helps in identifying potential defects easily.
The Flow of Test Case:
Flow of Test CaseTest Case Template
A Test Case Template is a simple, organized format used in software testing to create test cases. It helps ensure that all tests are written clearly and consistently.
Let's look at a basic test case template for the login functionality.
- The Test case template contains the header section which has a set of parameters that provide information about the test case such as the tester's name, test case description, Prerequisite, etc.
- The body section contains the actual test case content, such as test ID, test steps, test input, expected result, etc.
Below is the table that shows the basic template of a test case:
Fields | Description |
---|
Test Case ID | Each test case should have a unique ID. |
Test Case Description | Each test case should have a proper description to let testers know what the test case is about. |
Pre-Conditions | Conditions that are required to be satisfied before executing the test case. |
Test Steps | Mention all test steps in detail and to be executed from the end-user's perspective. |
Test Data | Test data could be used as input for the test cases. |
Expected Result | The result is expected after executing the test cases. |
Post Condition | Conditions need to be fulfilled when the test cases are successfully executed. |
Actual Result | The result that which system shows once the test case is executed. |
Status | Set the status as Pass or Fail on the expected result against the actual result. |
Project Name | Name of the project to which the test case belongs. |
Module Name | Name of the module to which the test case belongs. |
Reference Document | Mention the path of the reference document. |
Created By | Name of the tester who created the test cases. |
Date of Creation | Date of creation of test cases. |
Reviewed By | Name of the tester who reviews the test case. |
Date of Review | When the test cases were reviewed. |
Executed By | Name of the tester who executed the test case. |
Date of Execution | Date when the test cases were executed. |
Comments | Include comments which help the team to understand the test cases. |
In the given template below it's identifiable that the section from module name to test scenario is the header section while the table that lies below the test scenario (from test case ID to comments) is the body of the test case template.
Here a test case template for login functionality has been created with its parameters and values.
Test Case TemplateParameters of a Test Case
Here are the important parameters of the testcase which is helping to the development process of software:
- Module Name: Describes the functionality being tested.
- Test Case ID: A unique identifier for each test case.
- Tester Name: The name of the person conducting the test.
- Test Scenario: A brief description of what the test will cover.
- Test Case Description: Specifies the condition or feature being tested.
- Test Steps: A detailed list of actions to execute the test.
- Prerequisite: Any conditions that must be met before starting the test.
- Test Priority: Indicates the order of importance for testing.
- Test Data: Inputs required for the test.
- Test Expected Result: The expected outcome of the test.
- Actual Result: The actual outcome after test execution.
- Environment Information: Details of the test environment, like OS and software version.
- Status: Whether the test passed, failed, or is not applicable.
- Comments: Any additional notes about the test.
Here is an example of how the parameters of a test case can be represented
Example Test Cases for a Login Page
Below is an example of preparing various test cases for a login page with a username and password.
Unit Test case: Here we are only checking if the username validates at least for the length of eight characters.
Test Id | Test Condition | Test Steps | Test Input | Test Expected Result | Actual Result | Status | Remarks |
---|
1. | Check if the username field accepts the input of thirteen characters. | 1. Give input | geeksforgeeks | Accepts for thirteen characters. | Accepts for thirteen characters. | Pass | None |
Here it is only checked whether the passing of input of thirteen characters is valid or not. So since the character word 'geeksforgeeks' is entered then the test is successful it would have failed for any other test case.
Functionality Test case: Here it is checked whether the username and password both work together on the login click.
Test Id | Test Condition | Test Steps | Test Input | Test Expected Result | Actual Result | Status | Remarks |
---|
1. | Check that with the correct username and password able to log in. | 1. Enter the username 2. Enter the password 3. Click on the login | username: geeks for geeks password: geeksforever | Login successful | Login successful | Pass | None |
2. | Check that if with an incorrect username and password able to not login. | 1. Enter the username 2. Enter the password 3. Click on the login | username: geeksforgeeks password: geekstogether | Login unsuccessful | Login unsuccessful | Pass | None |
Here it is being checked whether passing wrong and right inputs and if the login functionality is working or not, it's showing login is successful for the right credentials and unsuccessful for the wrong ones, hence both tests have passed otherwise would have failed.
User Acceptance Test Case: Here the user feedback is taken if the login page is loading properly or not.
Test Id | Test Condition | Test Steps | Test Input | Test Expected Result | Actual Result | Status | Remarks |
---|
1. | Check if the loading page loading efficiently for the client. | 1. Click on the login button. | None | Welcome to the login page. | Welcome to the login page. | Fail | The login page is not loaded due to a browser compatibility issue on the user's side. |
Here it is being checked in by clicking on the login button if the page is loaded and the 'Welcome to login page' message is displayed. The test has failed here as the page was not loaded due to a browser compatibility issue, it would have loaded if the test had passed.
When do we Write Test Cases?
Test cases are written in different situations:
- Before development: Test cases could be written before the actual coding as that would help to identify the requirement of the product/software and carry out the test later when the product/software gets developed.
- After development: Test cases are also written directly after coming up with a product/software or after developing the feature but before the launching of a product/software as needed to test the working of that particular feature.
- During development: Test cases are sometimes written during the development time, parallelly. so whenever a part of the module/software gets developed it gets tested as well.
Test cases are typically documented in tools like Excel, Jira, or dedicated test management platforms. These tools help organize and track the test cases, ensuring they align with the required specifications with ongoing development. Test cases help in further development and make sure that we are meeting all the needed requirements.
Test case management tools are important in managing test cases efficiently, making the testing process faster and less time-consuming compared to traditional methods. These tools provide features such as advanced dashboards, bug tracking, progress tracking, custom templates, and integration with other testing tools. Test case management tools help testers organize, manage, and execute their tests more effectively.
Here are some of the most popular test case management tools:
- TestLink: TestLink is a widely used test management tool that offers easy integration with bug tracking systems and provides a user-friendly interface to manage test cases, test plans, and test runs.
- X-ray: X-ray is a test management tool for Jira, designed to manage both manual and automated tests. It integrates seamlessly with Jira, providing robust reporting, traceability, and tracking for test cases.
- TestRail: TestRail helps manage test cases, test plans, and test runs. It offers real-time insights into testing progress and enables better collaboration between QA teams, helping them streamline their test case management processes.
- PractiTest Ltd.: PractiTest is a test case management tool that focuses on organizing test cases, creating test plans, and offering detailed reports. It allows for seamless integration with popular bug tracking systems and other testing tools.
- TestCollab: TestCollab is a tool for managing test cases, test plans, and testing progress. It provides strong reporting and analytics features to give teams insights into their testing efforts.
- Kualitee: Kualitee is a comprehensive test case management platform that supports manual and automated testing. It provides features for test case creation, execution, and tracking, along with strong integration with bug tracking tools.
- Qase: Qase is an easy-to-use test management tool that supports manual test execution and test case management. It integrates with various CI/CD tools and offers powerful reporting and analytics features.
- Testiny: Testiny is a lightweight test management tool that provides an intuitive interface for managing test cases. It allows easy tracking of test executions and facilitates collaboration within teams.
- TestMonitor: TestMonitor is a test case management platform designed to enhance collaboration among teams. It offers comprehensive features like test case management, test plan creation, bug tracking, and detailed reporting.
- SpiraTest: SpiraTest is a test management tool that allows users to manage test cases, bugs, and requirements in one integrated platform. It provides full traceability and powerful reporting for effective test case management.
- Formal Test Cases: Formal test cases are test cases that follow the basic test case format. It contains the test case parameters such as conditions, ID, Module name, etc. Formal Test cases have set input data and expected results, they are performed as per the given order of steps.
- Informal Test Cases: Informal test cases are test cases that don't follow the basic test case format. In these, as the tests are performed the test cases are written in real-time then pre-writing them, and the input and expected results are not predefined as well.
Benefits of Writing High-Quality Test Cases
Writing high-quality test cases offers numerous benefits that contribute to the effectiveness and efficiency of the software testing process. Some benefits are listed below:
- Improved Test Coverage
- Enhanced Communication
- Consistency and Repeatability
- Efficient Defect Identification
- Improved Test Automation
- Increased Confidence in Software Quality
Similar Reads
Software Testing Tutorial Software testing is an important part of the software development lifecycle that involves verifying and validating whether a software application works as expected. It ensures reliable, correct, secure, and high-performing software across web, mobile applications, cloud, and CI/CD pipelines in DevOp
10 min read
What is Software Testing? Software testing is an important process in the Software Development Lifecycle(SDLC). It involves verifying and validating that a Software Application is free of bugs, meets the technical requirements set by its Design and Development, and satisfies user requirements efficiently and effectively.Here
11 min read
Principles of Software testing - Software Testing Software testing is an important aspect of software development, ensuring that applications function correctly and meet user expectations. From test planning to execution, analysis and understanding these principles help testers in creating a more structured and focused approach to software testing,
3 min read
Software Development Life Cycle (SDLC) Software Development Life Cycle (SDLC) is a structured process that is used to design, develop, and test high-quality software. SDLC, or software development life cycle, is a methodology that defines the entire procedure of software development step-by-step. The goal of the SDLC life cycle model is
8 min read
Software Testing Life Cycle (STLC) The Software Testing Life Cycle (STLC) is a process that verifies whether the Software Quality meets the expectations or not. STLC is an important process that provides a simple approach to testing through the step-by-step process, which we are discussing here. Software Testing Life Cycle (STLC) is
7 min read
Types of Software Testing Software testing is a important aspect of software development life-cycle that ensures a product works correctly, meets user expectations, and is free of bugs. There are different types of software testing, each designed to validate specific aspects of an application, such as functionality, performa
15+ min read
Levels of Software Testing Software Testing is an important part of the Software Development Life Cycle which is help to verify the product is working as expected or not. In SDLC, we used different levels of testing to find bugs and errors. Here we are learning those Levels of Testing in detail.Table of ContentWhat Are the Le
4 min read
Test Maturity Model - Software Testing The Test Maturity Model (TMM) in software testing is a framework for assessing the software testing process to improve it. It is based on the Capability Maturity Model(CMM). It was first produced by the Illinois Institute of Technology to assess the maturity of the test processes and to provide targ
8 min read
SDLC MODELS
TYPES OF TESTING