A Test case is a set of test inputs, execution conditions, and expected results, develop and executed in sequence to validate the feature of an application. It contains precondition, test steps, test data, and expected results to validate a particular test objective which would be followed while test execution to determine if the system is working as per the expected behavior.
Writing effective cases means?
Writing a good test case requires basic writing skills, attention to detail, and a good understanding of the application under test (AUT). Well written test cases mean the difference between a well-tested application and a poorly tested application. The quality of the product increases with the number of test cases since each test case has different scenarios, conditions, or steps to execute. Since it verifies the requirements-based coverage based on the number test cases identified/implemented therefore critical test cases verification with every build becomes very effective.
Types of test cases written
Functional test cases – These test cases focus on testing the functionality of the application with positive conditions.
Negative test cases – These cases belong to unacceptable, abnormal, or unexpected conditions or data, to demonstrate that the requirement is only achieved under the desired condition.
Boundary value test cases – These cases focus on testing the boundary conditions.
How to write effective test cases
1. Testcases should be simple and clear
Test cases should be simple and can be easily understandable. It happens that the person who wrote the test case might not be the one who also executes itself, thus the steps should be self-explanatory and have the necessary information on how to execute the test. It is necessary to keep the test cases simple and easily understandable by incorporating all the necessary steps so that it could be revised or executed by anyone.
2. Testcases should have a strong title and description which clearly state its objective
An effective test case starts with a strong title which clearly states the test that has to be performed along with a unique identifier so that it can be referenced and easily bring up later from a test suite. The title of the test case should be short and effective. With which the description of the test case is needed which should states the objective of the test case means ‘What is going to be tested?’. Sometimes in a description test environment, test data, and preconditions/assumptions are also mentioned.
3. Testcases should not be repetitive
It is very much needed to avoid the repetition of test cases which help to get the exact scope of testing. If a test case is needed to be performed as a precondition for another test case then instead of writing test case again, it is better to give the reference of the test case by its case id in the pre-requisites section.
4. Testcases should include the Assumptions and Pre-conditions
Any assumption which is applied to the test and any pre-condition that must be met before starting execution should be clearly mentioned and described in the test case. Information such as page details from where the tester should start the test, dependencies on the test environment, and any setup requirements that must be done before running the test should be included in the test case.
5. Testcases should be reusable
Good test cases are reusable and provide long-term value to the software testing team. This helps to use the same test case instead of re-writing it again for different test cases.
6. Testcases should ensure good coverage
Testcases should be written considering all software requirements specifications or user stories. It is always better to figure out all features of the application prior to starting designing the test cases. A traceability matrix can be used to ensure that no requirements or conditions are left untested.
7. Testcases should include user scenario’s
While writing test cases it is required to always concentrate on real-life scenarios first which end-user is going to perform in day to day life activity and accordingly test cases should be prepared. This would ensure that the software meets client expectations.
8. Testcases should be peer-reviewed
It is always important to get the test cases reviewed by colleagues or SME (Subject matter expert) as reviews from others can uncover the defects in test case design or those scenarios which got missed.
Format of test case
Test case id – (Unique Identifier)
Test case Title – (Short description of test case & should be effective to convey the test case)
Test case Description – (Detailed description of test case & additional information needed for the test case to execute)
Pre-condition– (Any pre-requisite required to execute the test case)
Test data– (The data which would be used as inputs for the test case to execute)
Test Steps – (Steps to be followed or executed)
Excepted Result – (Result which is expected as normal behavior)
Actual result – (Result which we actually get after we execute the test step)
Test Case Status (Pass/Fail) –(If Actual result and the expected result is same then test case marked as Pass or else Fail)
Comments – (Additional Comments or notes required while executing test case which needs to be considered)
Example of Test case