1. What is the concept of test cases?
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.
2. Steps to design a test case
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.
3. Structure of a test case
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.
4. Define the test case
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.
5. Write test cases for the Facebook login function (on Desktops)
Step 1: Identify the requirements.
- Your first mission is to test the login form of Facebook: https://www.facebook.com/
- Test purpose: Test the login success to Facebook (only on the web environment), do not test the registration function.
- Performance testing: The login form typically includes 2 textboxes: email/phone and password, a login button, a forgotten password link.
- Identify non-functional requirements: Check the confidentiality of non-registered emails, save the password to the browser. Additionally, check the network system and computer hardware.
- Determine the suitable test case template: The requirements will include testing components such as UI, login function, login speed.
- Determine the interaction between the modules: Check the authenticity of the user’s login account. After the successful login, redirect the user to Home Page.
Step 2: Construct the test cases
- Defining UI cases: UI cases include color, font, size, color of the label, length, width, height, type of textbox, button, position of the form, textbox, button, link on page … If each UI is split into one case, the test cases will be too long, so we should merge them into a common UI test case or split them into UI subclasses.
- Defining functional cases: The function here is to login into Facebook with 2 textboxes, which are email/phone and password, a login button, a forgotten password link. So there will be cases as follows:
- For email/phone box:
- The normal case will include: Login with a correct phone number or email address, and login with a blank, wrong phone number or email address.
- The abnormal case will include: Login with a phone number with an area code (e.g. +849….) or an email address without email domain. In addition, there are cases like network disconnection, cookie steal, login on many browsers …
- The boundary case will include: Test the minimum and the maximum number of characters that can be input in each text box. Create an email with multiple characters to test, or the shortest possible email to test.
- Similar to the password box, but it needs to be checked the encryption.
- For the login button:
- The normal case will include: Enter a value in the textbox, click the login button or press Enter from the keyboard.
- The normal case will be: Click the Continue button
- The boundary case will include: no need to check this case
- For email/phone box:
- Test Plan Template
- Different Types of Test Design Techniques You Need to Know
- All Things You Need To Know About Exhaustive Testing