Luxe Quality logo
Quality Assurance

Oleksandr Leonov, QA Automation Engineer Lead & Mentor's Scrum Master

Aug 08, 2023 16 min read

How to Write Test Cases for Software Testing: A Complete Guide

Test cases help testers test a software product's functionality systematically. Each test case describes a specific test scenario, including the actions required to execute the test and the expected results. With a correctly compiled and detailed test case, the tester can confidently check the operation of the software product and identify possible defects.  

How to Write Test Cases for Software Testing

What is a test case, and why is creating a test case in software testing so important?

A test case is an essential component in software testing documentation. This document (you can review QA documentation in software testing in more detail) contains a detailed description of steps, specific conditions, and parameters necessary for appropriately verifying the implementation of the function under test or its parts. 

Test cases help testers test a software product's functionality systematically. Each test case describes a specific test scenario, including the actions required to execute the test and the expected results. With a correctly compiled and detailed test case, the tester can confidently check the operation of the software product and identify possible defects (you can also learn how to write a bug report effectively to streamline communication between testers and developers during the software development lifecycle). 

This article covers test case structure, offers a list of helpful test case management tools, and shares valuable tips from our professionals to ensure the writing of high-quality test cases. 

What is the test case structure?

Attention should be paid to the fact that a test case in software testing means a structure of the type: Action > Expected Result. For a better understanding, let's describe the structure of the test case in more detail:  

  1. ID (number): The unique identifier of the test case helps track it more efficiently during testing. It is often used to organize the indexing and searching of tests in test case managers. Such IDs are created automatically in the Test Management System.   
  2. Name: Descriptive name of the test case, which conveys its essence and the functionality being tested. A well-chosen name helps to understand the content of the test case quickly. 
  3. Preconditions (conditions and parameters): Located in the Preconditions section, these conditions define the system's initial state before running the test. They indicate the system's state where the test can be correctly performed.   
  4. Steps: This section contains a sequence of actions the tester must perform to execute a specific test scenario. Each step should be clearly described and easy to understand. 
  5. Test Data: The specific data (like login and password) needed for passing the current test case. It also may be specified in Preconditions or exact Steps. But to keep the test data separate – it's good practice. Not every step of a Test Case needs Test Data
  6. Expected result: Defines the expected behavior after each executed test step. The tester compares actual and expected results to detect bugs. 
  7. Postconditions: This section may include actions after completing the test to return the system to its initial state. This can be useful if the test modifies data or system settings.
exclamation mark icon

Postconditions and Precondition are not mandatory parts. This is most likely a rule of good manners: "Before the test – set up your system, and If you've messed up – clean it up after yourself." This is especially relevant for automated testing when one run fills the database with hundreds or thousands of incorrect documents.  

Test cases should cover different positive and negative scenarios and other options. Organizing test cases in logical groups (test suites and test plans) and adding links to the corresponding requirements, which supports greater transparency and ease of requirements tracking, is also recommended (you can also discover how to create a test plan for software testing to ensure thorough testing coverage and efficient project execution).

For a better understanding of the above-described structure, we have prepared for you a simple test case example  for a web application with a table view: 

In this example, we presented two test cases: the first checks the system's valid login (positive scenario), and the second - a negative scenario when an invalid password is entered. Each test case has its unique ID and name, specified conditions and parameters necessary to run the test, steps to execute expected results, and possible postconditions. It's good practice to type the function's name to be tested in the current test case before its name (to see the group of test cases of the same function). Using "Log in with valid credentials" is better than "Valid Login." 

Information you need to know to write test cases: the main types

Test cases can be of different types depending on the test scenario. 

Positive test cases: This type of testing is performed in software by providing valid data sets as input. It checks whether the software behaves correctly with positive input data or not. Positive testing is performed to verify that the software does exactly what is expected.

Negative test cases: This testing method is performed in software by providing invalid or incorrect input data sets. This type of testing checks whether the software behaves correctly with negative or unwanted user input. Negative testing ensures the application does not crash and remains stable with invalid inputs. 

Also, test cases can go through different life cycle stages and have different states during testing. Most test management systems can be easily customized and take any form. Here are some of the most common options: 

 States of the test case:

  • Draft: The test case is created. 
  • Approved: The test case is fully complete and ready for execution. 
  • Modified: The test case has been modified or updated after creation. 
  • Retired/Deprecated (no longer valid):The test case is irrelevant and cannot be executed.

Statuses of the test case during the test execution: 

  • No run: The test case has not yet been started for execution. 
  • In Progress: The test case is executing right now. 
  • Passed: The test case was executed successfully, and the result is as expected. 
  • Failed (error): The test case did not pass because the result did not match the expected or defects were detected. 
  • Blocked: The test case cannot be executed due to unavoidable circumstances, such as an unstable environment or lack of resources. 
  • Skipped: The test case was not executed due to some reasons. 
  • Retest: The test case should be passed again after solving some issues with the system (with a description of a trigger for retesting).

Knowing the basic types and statuses helps you manage test cases or extensive test plans more effectively.

How to write test cases: detailed description

We are professionals in this field with much experience creating test cases. The importance of quality test cases in the software testing process cannot be underestimated. They are essential for comprehensive testing of the functionality of the application and its compliance with technical requirements. 

Our team has prepared a detailed list of steps for creating easy-to-use test cases, which will help improve your software. 

Step 1: Analysis of software requirements and case-specific requirements

Successful software testing begins with a thorough analysis of its requirements and functionality. During the analysis, you should pay attention to all the details the customer discloses and identify specific requirements for this case. This allows you to create high-quality test cases considering all the software's features. 

You should pay attention to the following aspects before creating test cases: 

  1. Software requirements: check all the requirements that apply to the application, including functional and non-functional requirements. 
  2. Functionality and usage scenarios: develop scenarios covering various user actions with the application. 
  3. Roles and access rights: understanding user roles and their access rights in the application. 
  4. Technical limitations: analysis of technical limitations such as operating systems, screen resolution, languages, etc. 
  5. Expected results: define each test case's expected results to verify the program's correct operation.

Such careful analysis helps ensure the high quality and efficiency of test cases.

Step 2: Prioritization of functionality to be covered by test cases 

Prioritizing functionality to be covered by test cases is a critical step in software testing. Usually, test case prioritization is already included in the test plan, which describes testing strategies, tasks, deadlines, and scope of work (to learn how to create a high-quality test plan and avoid common mistakes, click here). But if these priorities have not been determined, it is essential to take this step yourself. Creating different test suites for different types of testing, such as regression, smoke, API, microservices, functional testing, etc., helps group test cases for different parts of the system. 

Regression test suites allow you to verify that new changes do not affect existing functionality and ensure it works correctly. Smoke testing, in turn, helps to check the application's basic functionality for the absence of critical errors after significant changes or updates.   

Also, for additional reliability and checking for interaction with other systems, separate test suites can be created for API and microservices testing. These tests help verify that the application interacts with other system components as expected. 

Because resources can be limited, developing a prioritization strategy that considers functionality importance, risks, timelines, and business needs is essential. For better visualization, special tools are used to manage test documentation and prioritize tasks such as test case managers or tracking tools. 

The overall result of effective prioritization is to minimize the time, effort, and cost required to perform tests and ensure high software quality.

Step 3: Test data

An important component of the software testing process is test data preparation. Test data must be carefully prepared and balanced to account for the variety of possible applications of the software. Test data preparation for BE testing requires additional knowledge about the database structure, tables used, fields, and relationships between them. 

For efficient test data preparation, you can use special tools (for example, Data Generator) to create test data sets or scenarios. Such tools help automate the process of preparing test data and reduce the risk of errors.

We have prepared a table with examples of prepared test information:

This table has several rows with different data combinations that can be entered into the registration form. Each line represents a separate test scenario where we test different combinations of information.

For example, in the first line, we check whether the user registration is processed correctly with correct data such as first name, last name, email, password, age, and country. In the second line, we check how the program handles an incorrect password that does not meet security requirements. In the third line, we check the processing of an invalid age value.  

Thus, the test data table helps to perform various test scenarios and verify the correct operation of the software under different conditions of use. 

Step 4: Clear Description of Steps

Clearly described steps in test cases are essential to successful software testing. They ensure the testing process's clarity, accuracy, and repeatability, facilitating effective problem detection and resolution. 

Consider a non-professional description of the steps in the test case:

  1. Login; start a case. 
  2. Click "Update Location" on the top left between the App catalog icon and the Patient name banner. 
  3. Select Unit and enter SubUnit, Room, Bed, and Time data.

This example is marked by a lack of specific details, such as the required data to fill in the fields, the initial state of the case, and even the missing fourth step associated with pressing the "Proceed" button. It is essential to provide the following thorough instructions: 


  1. Login to the account. 
  2. Create a new CDS case.

Steps to reproduce:

  1. Click the "Update Location" button. 
  2. Set "Unit", "SubUnit", "Room", "Bed", and "Time" fields with valid data. 
  3. Click the "Proceed" button.

This will ensure the clarity and comprehensibility of the described steps for the successful execution of the test scenario.

Step 5: Expected result

In a technical context, the expected result is determined based on software requirements and specifications analysis. It is often formulated as specific values, system states, messages, or reactions that should occur after the test is executed. 

An example of a test script and its expected result for a simple web application: 

This is just an example of a simple test script for a web application. In real projects, test scenarios can be much more complex and include many different actions and expected results to ensure the quality and reliability of the software.  

Learn how to write test cases effectively with tracking systems 

Writing and combining cases into test suites is possible in different editors - tables or folders with files. However, using special applications is a more convenient and rational approach.

A good tool for creating test scenarios has the following advantages: 

  1. Attachment support.
  2. Assembly of cases into suites 
  3. Integration with the Task Management Systems 
  4. Creation of the Test Runs and Reports 
  5. Integration with automation scripts 

Among the available tools for creating test cases, four popular ones can be distinguished:  

QASE is a modern cloud-based test management platform that helps organize and manage the testing process. Its user-friendly interface makes creating, executing, and tracking test cases easy. One of the strengths of QASE is its integration with various test automation and reporting tools, allowing you to implement automated test scripts and analyze test results efficiently.  

Zephyr is another popular system for tracking test cases. It integrates with various tools, such as JIRA and Confluence, providing a convenient interface for creating, executing, and tracking test cases. Zephyr allows you to efficiently track test progress, store test run history, and provide detailed reporting to analyze results. 

TestLink is a free test management system with a simple design and a relatively user-friendly interface. The program allows you to configure user access levels, create product requirements, and use attachments. 

TestRail is a powerful tool with a user-friendly interface. It allows you to configure fields flexibly and can integrate with bug-tracking systems. Easy to use and convenient for creating and analyzing test runs. 

Test case creation tools can significantly improve the quality of testing. When everything is organized, located in one place, and the results of passing the cases are clear and well visualized, the efficiency of the test process increases. 

Our tips for increasing the effectiveness of test cases

Our team of specialists is ready to share practical tips for creating test cases with you. 


Formulate the topic of the test case clearly and understandably: this makes it difficult to understand what functionality this test case is supposed to testand perceive the test suite as a whole.


Use test case template: create standard templates with critical elements such as description, steps, expected results, and preconditions. Templates will help standardize the format and structure of test cases, making them understandable and the same for all project participants.


Periodically update test cases: update test cases regularly when functionality changes, or new features are added. This will help ensure the relevance of tests. Regularly updating test cases helps avoid the pesticide paradox.


Using the traceability matrix: create a traceability matrix for the test cases. This will help rate the degree of testing coverage and track which requirements are not covered by tests.


Writing down all the steps and expected results: to ensure the completeness and accuracy of the test case, it is essential to analyze the test cases from the requirements perspective and meticulously write down all the steps and results, including even the seemingly obvious ones. 


Test casesin manual testing:manually write test cases before moving to automation. Ensure each step is written correctly and the test case works before creating automation.


Add screenshots and short videos where needed: in many cases, when the textual description of the step does not provide a complete understanding of when the expected result is not apparent, it is advisable to use screenshots and short videos attached to the test case to illustrate to the tester what exactly he should do or what exactly he should get.


Overall, the article is an excellent reference for beginners and experienced testers. It not only explains the fundamental concepts of test case creation but also offers valuable insights and tips derived from the expertise of professionals in the field. If you have questions or need further assistance, reach out today. We're here to help!

Have a project for us?

Let's make a quality product! Tell us about your project, and we will prepare an individual solution.

Frequently Asked Questions

How to start writing a test case?

To write a test case, you must first understand the functionality or feature you want to test. Define the purpose of the test and establish the test preconditions and requirements. Next, create a step-by-step description you need to take to complete the test. Finally, describe the expected results and any postcondition required for the test case.

Which is better: test case vs test scenario?

Test cases and test scenarios are two different software testing documentation types. A test case provides detailed instructions for testing a specific aspect of an application, allowing you to perform testing and record results confidently. On the other hand, a test scenario is a sequence of tests combined to provide E2E checking of some user scenario (for example, find a product in the catalog -> go to its page -> place an order -> pay for the purchase. Each approach has advantages, and their use depends on the project's needs and the software's specifications.

Is it possible to write test cases in Jira?

Creating test cases in Jira is possible using test management applications such as Zephyr, Xray, and others. It allows you to manage tests directly in Jira and facilitates collaboration between developers and testers.

How to implement changes in test cases during the development of a software product?

Test cases should be updated regularly, especially when functionality or interface changes. Changes made to the test cases should be documented.

What are the main steps for preparing test data for test cases?

The tester should analyze the test requirements and determine what data is needed to perform each defined step, then generate test data according to the scenario and ensure that the prepared data reflects the different usage conditions of the application.

Recommended Articles