What is a test case?
A test case is a methodological list of steps with procedures, inputs, and expected outputs for a specific functional requirement or property in a computer program. It can be written in various formats, such as storyboards, flowcharts, and even as a simple text document. The main purpose of writing test cases is to make it easier to evaluate a set of features by providing clear step-by-step instructions on how to test them.
Why is a test case important?
Test cases help ensure that a certain feature or process works as intended. It is a definition of the behavior of the system (requirements). It specifies what to look for rather than how to operate the system.
Test case rules
Each test case should cover only one scenario that can cause a defect or failure. Test cases should be written in a narrative form to describe the action taken, inputs, and expected outcomes. Test cases should be reasonably short and contain only what is necessary to describe the functionality of the test and to highlight any weaknesses in the test. Any additional content that is not necessary for testing the feature is then rather counterproductive.
The test case includes:
- Test ID. This is usually a numeric or alphanumeric code. It is used by testers and QA to sort and group related tests into test spaces, test groups, or test suites.
- The name of the test. As the name suggests, this section briefly describes what will be investigated by the test – the feature or functionality to be tested.
- Goal. A few sentences describing the intention of the test, clearly and to the point. It is a very important part of the test case because it sets the rules for the entire process.
- References. These can be bugs, stories, or design requirements that will be subject to verification by a test case. It provides context for the test case and shows its origin.
- Prerequisites. A test often requires certain conditions to be met in order for a tester to pass the test – these are described as test prerequisites.
- Test settings. In connection with the prerequisites, the setup describes all the elements needed for a correct and trouble-free trial operation. This can be, for example, the version of the application, security settings, operating system or time and date.
- Test steps. This component contains a detailed description of the actions in the exact order in which the actions must be performed in order for the test to be completed.
- Expected results. This should form the framework for how we expect the system to respond to each of the test steps described. It is then compared to the actual response of the system.
How to Write a Test Case
Writing test cases is a very important skill and has been considered one of the most difficult aspects of software testing. It requires good analytical skills and a deep understanding of the objectives, requirements, and functions of the test. There are several best practices for writing test cases, and they all share one key requirement – the accuracy or specific purpose of each step of the test case. Test cases should also be economical in terms of unnecessary steps or words used during the test case to ensure maximum efficiency. Traceability is also a critical aspect of writing test cases, as it can lead to problems if the requirements and their origins cannot be traced back.
Types of test cases
Functionality test cases
These test cases (sometimes also referred to as "black box testing") verify the functionality of the application's interface with a) the user and b) the rest of the system. One of the main aspects of functional testing is that there is no need for access to the internal structure of the software, as the tests are performed externally. Functional test cases are often based on predefined user stories or required system specifications.
Performance test cases
This type of test case verifies the effectiveness of the system in speed and response time. Its main purpose is to get a very well-defined picture of the system's performance in real time as soon as it is launched. Automation is often used in performance testing due to the sheer number of actions required to perform these tests.
Unit test cases
Units or components are the smallest software parts that can be tested. Therefore, unit testing typically consists of a very small number of inputs and a single output. Unit testing is a very detail-oriented testing approach that checks the functionality of a unit one component at a time.
User interface test cases
User interface testing (or UI testing) verifies the functionality and performance of given GUI (graphical user interface) elements. The main quality of UI testing lies in its ability to detect errors and errors in the user journey, such as graphical inconsistencies, spelling mistakes, or broken hyperlinks. It verifies the smoothness of a specific user journey across devices and environments – cross-browser functionality or OS compatibility is also tested.
Security test cases
As the name suggests, security testing verifies the system's security settings and permissions and the protection of sensitive data. Authentication and encryption testing is often in the spotlight, and the most common type of testing for security test cases is penetration testing. As cybersecurity becomes more important for businesses, security testing is also becoming increasingly important.
Integration test cases
Integration testing shows how different parts of the software work together. Interfaces, modules, and interactions must be synchronized, and verifying this is the task of integration testing.
Database test cases
The main purpose of database testing is to verify the correct data transfers within the system, or to verify the functionality of the internal database. In general, SQL queries are used to create database test cases.
Usability test cases
Usability testing is usually the task of the design team – it consists of a general task or scenario that needs to be completed, provides no detailed information, and observes how the user naturally interacts with the application to complete the task. Usability test cases help uncover issues and inconsistencies in user experience (UX) and user interface (UI) before the user adoption phase.
User Acceptance Test Cases (Acceptance)
User acceptance testing is the next step after usability testing. It doesn't focus on specific modules or features, but tests the application or system as a whole. The goal is to find out how acceptable, usable and understandable the entire software is for the end user. User acceptance testing is usually the last testing effort before a product goes into production to ensure that everything is working and in place.
Regression testing
Cases of regression testing come after each software update or new release to ensure that none of the code changes have disrupted the functionality of the application. Basically, it is a series of test cases or repeated test scenarios that go through the entire software and check its status. Test automation also comes in handy here, as it is a series of many routine test executions that take a lot of time and manpower, and bots can save a lot of time.
Test script vs. Test case vs. Test scenario
At first glance, test scripts, test cases, and test scenarios may look like the same thing, but they are not.
- Test scenario – An instance of software or a specific environment used as input for either creating new test cases or leveraging existing ones.
- Test case – a description of what functionality or behavior should be tested and what the results should look like.
- Test script - detailed and factual steps of test execution.
