Test cases are a set of conditional cases in which a tester can rely on to determine whether an application, a software system, or one of its features performs as desired or not.
A test case is a single executable test which a tester carries out. It guides them through the steps of the test. You can think of a test case as a set of step-by-step instructions to verify something behaves as it is required to behave.
Step 1: Define the purposes of your testing process.
First, you need to understand the software requirements specification. When starting to write test cases for the features of a software, the first thing to do is to understand and determine the requirements of the system.
Step 2: Determine the performance indicators of your software system. (based on your understanding of the system)
In order to write a good test script, you need to be familiar with the functional requirements. You also need to know how the software used including various functionalities and organizational functions.
Step 3: Identify non-functional requirements.
The third step is to understand other aspects of the software related to non-functional requirements, such as hardware requirements, operating systems, security aspects. They need to be considered as other prerequisites aside with test data preparation.
Testing non-functional requirements is very important. For example, if the software requires a user to fill in forms, you must determine a reasonable timeframe so that your user will not run out of time while waiting for submission. At the same time, it is also important to check the log-in time to ensure that the user session is not expired, which is called security test.
Step 4: Determine the test case template
Test case samples, test case templates that should be chosen must include test types such as UI, functionality, fault tolerance, compatibility, and performance. Each type should be defined in accordance with the logic of the application.
Step 5: Indicate the interaction between the modules of the software
At this point, you have to understand the functionality of each module and its interactions with other modules to identify the system flow. Test cases should be designed to cover the highest level of module interactions. For example: When testing the shopping cart feature of an e-commerce website you need to test the inventory management system to validate if the same number of purchased products is deducted from the store. Similarly, when handling re-testing, you need to test its impact on the financial part of the application along with the inventory management system.
The format of a typical test case includes:
Test Case ID: The value needed to determine the number of instances required for testing.
Function: Based on the functionality of the system you can split the functions to create clearer test cases.
Test Data: The data that need to be prepared for testing.
Test Steps: Describe the test steps.
Expected results: Expected results from the steps above.
A result: Usually is PASS, FAIL, or PENDING. This is the actual result of the test case in the system environment.
Comments: This column is used to note screenshots and related information when executing test cases.
Besides, you can add more columns such as: Testers, Execute Date, etc.
With each testing value there are always 3 scenarios that can happen:
- Normal case: common test cases
- Abnormal case: abnormal test cases
- Boundary case: the boundary test cases. In larger cases, it will be divided into smaller cases correspondingly.
Read more for a practical example of writing test cases for the Facebook login function at https://testautomationresources.com/software-testing-basics/writing-test-cases/