What are test cases? How can I write good and effective test cases? Let’s find out the answer about what a test case is and how to write an effective test case.
1. What are test cases?
Test cases (Test scenarios) are also abbreviated to TCs, are testing possible situations that help Testers determine whether an application, software system or an application function is working properly or not. Test cases describe input data, action or event, and an expected response.
2. Steps of identifying basic test case
1. Determine the purpose of testing
- First, you need to clearly understand the customer's requirement specification.
- When starting to write TCs for the features of a software system, the first thing to do is to understand and define the requirements of the system.
2. Determine function of software system
To write a complete test script, you need to know what function the Module you are testing has, whether its data affects other parts or not.
3. Determine non-function requirements
Hardware, operating system or security requirements must be identified. Non-functional testing is very important, for example software that requires stable speed when there is a large number of visitors at a time. In addition, you also need to check the login time to make sure the user's session is not expired.
4. Determine test case form
Test cases should include UI (User Interface), functionality, compatibility and performance of some functions. Each category needs to be defined to match the logic of the software product.
5. Determine the influence between modules
A software product consists of many interrelated modules, you need to have a good understanding of the functions of each module, the interaction between the modules to ensure that the cases cover all the influences between them.
3. Structure of test case
Format of a test case normally includes:
- Test case ID: The value to determine the number of test cases.
- Test items: Depending on the function of the system, the functions can be split off to create clearer TCs
- Pre-condition: precondition (if any)
- Test data: Data needed to prepare for testing
- Test steps: Steps for executing test
- Test viewpoint: Viewpoint of testing
- Test viewpoint content: Content of test viewpoint
- Expected results: Expected results from test steps
- Actual results: Actual results from test steps
- Comments: noting when executing test
In addition, there can be other columns such as: tester name, execute date, etc.
4. Effective test case is required
- Accurate, complete system business
- Independent (can be done without depending on other test cases, easily divided among many testers)
- The content is simple, clear purpose and is understood by all testers in a unique way (input, output, clear steps)
- Reusable (can be easily updated and modified)
- Cover 100%: Make sure you write TCs to test all the software requirements mentioned in the specification document
For example, let’s write test cases in which test number of digits in password is entered text box. The number of characters the user can enter into the password field is 6-32 characters.
A high-quality testcase will help cover all possible cases, avoiding invalid bugs that affect the quality of the product. Therefore, you need to be very careful when writing test cases to get the best results.