Updated July 10, 2023
Introduction to Test Case
A test case is a document that contains a various set of data, conditions to be performed and the expected result for the particular condition, developed by the software testers to perform the execution of the particular part of the software to verify the working of the software against requirements. To perform the test, this case use parameters like test scenario, test ID, prerequisites, description, test data, test step, test results, test parameters, actual results, various environment, environment information.
Template
It usually has the following fields. However, the format of the fields may differ from company to company, depending on the test management tool used by them.
ID | The ID is given to the test case. |
Description | The description of the test case. |
Related Requirement | The ID is given to the requirement that this test case maps to. |
Prerequisites | Any preconditions or requirements that are to be satisfied before running the test. |
Test Steps | Step-by-step instructions were given to run the test. |
Test Data | Data that is used while conducting the test. |
Expected Result | The result that is expected from the test, logged before running the test. |
Actual Result | The actual result obtained after running the test |
Status | The status obtained after running the test. It can be Pass, Fail, Not Executed, Blocked. |
Comments | Any remarks to be given for the test. |
Environment Information | Includes Network/Hardware/Software information in which the test is run. |
How to Write a Test Case?
Below are the steps:
Step 1: Assign a Number and a Description.
Step 2: In order to run it, we need Test Data. Without the test data, we would not have the proper information to test, making the task laborious.
Step 3: To run it, we need to have a certain set of instructions to carry out the test. These steps are called Test Steps. The need for this arises, when the author resigns from the project or is on a break. Then someone else from the project will need to take up the testing. Written steps will help them.
Step 4: The aim of them is to examine the behavior of the application. To perform this, we will need to have an Expected Result. After its execution, expected results will be compared with the Actual Result from the test, and accordingly, a Status will be assigned to it.
Step 5: We can also have an Additional field like the Prerequisite field, which tells us the conditions to be met before the test run, a Post-Conditions field, which tells us the conditions to be met after the test run, etc.
Example:
ID | Description | Test Steps | Test Data | Expected Result | Actual Result | Status |
TC01 | Check Employee Login with valid Data |
1. Go to the login page. 2.Enter Userid 3.Enter password 4. Click on the Login button |
Userid= admin
Password= abc12345 |
User should be able to log in | As Expected | Pass |
TC02 | Check Employee Login with invalid Data | 1. Go to the login page.
2.Enter Userid 3.Enter password 4. Click on the Login button |
Userid= admin
Password= 12345abc |
User should not be able to log in | As Expected | Pass |
Importance of Test Case
They have a huge impression on the testing phase. Writing them is as significant as the testing process itself. It helps us think through the specifics and ensures that we are tackling them from as many outlooks as possible.
The importance of having it is that anyone can retest the test using them. They are potent artifacts that are useful to future teammates, in addition to providing documentation on how an application performs. To sum up, They provide the following significance:
- They ensure good coverage of the test, making sure the main functionality is not missed during testing.
- It allows them to think of different ways of confirming the features of the application, thoroughly.
- Negatives are also written, making the testing a thorough process, with little being overlooked.
- They are reusable, as anyone can refer them and run the test.
Useful Tips and Tricks
When writing them, keep in mind the following information:
- It should be simple and concise, with not more than 15 steps.
- Each of them is to be made reusable.
- Avoid repetition.
- Additional test setup information is to be provided like software, hardware, operating system, version of the application under test, prerequisites for the test, etc.
- It should be written in a way that we test only one thing at a time, with no overlaps.
- Ensure that all scenarios, positive and negative, are covered, giving us 100% coverage.
- They should be created with the end-user in mind.
Conclusion
To conclude, They can enhance our efforts in overall testing and can improve our software quality to great ends, while saving us time and effort due to the reusability of test cases.
Recommended Articles
This is a guide to What is Test Case. Here we have discussed the Template, Importance, and Useful Tips and tricks. You may also look at the following articles to learn more –