What is a Test Case?
A test case template is a document that comes under one of the test artifacts, which allows testers to develop the test cases for a particular test scenario in order to verify whether the features of an application are working as intended or not. Test cases are the set of positive and negative executable steps of a test scenario which has a set of pre-conditions, test data, expected results, post-conditions, and actual results.
Most of the companies are using test case management tools such as Quality Center (HP QC), JIRA, etc., and some of the companies still using excel sheets to write test cases.
Check the below video to watch “How To Write Test Cases Manually”
What is the difference between Test Scenario vs Test Case?
Test Scenario: Test Scenario gives the idea of what we have to test. Test Scenario is like a high-level test case.
For example: Verify the login functionality of the Gmail account.
Assume we need to write test cases for a scenario (Verify the login of the Gmail account).
Here are some test cases.
1. Enter valid User Name and valid Password
2. Enter valid User Name and invalid Password
3. Enter invalid User Name and valid Password
4. Enter invalid User Name and invalid Password
Who Writes Test Cases?
It varies from company to company. Assuming that a team contains developers and dedicated testers then it might be something like a joint effort.
- Developers write Unit Tests
- Developers & Testers write Integration Tests
- Testers write Acceptance Tests
General Test Case Template Format
Find the test case template screenshot below:
How To Write Test Cases in Manual Testing
Follow the below steps to write the test cases.
Step #1 – Test Case ID:
Each test case should be represented by a unique ID. It’s good practice to follow some naming convention for better understanding and discrimination purposes.
Step #2 – Test Case Description:
Pick test cases properly from the test scenarios
Test scenario: Verify the login of Gmail
Test case: Enter a valid username and valid password
Step #3 – Pre-Conditions:
Conditions that need to meet before executing the test case. Mention if any preconditions are available.
Example: Need a valid Gmail account to do login
Step #4 – Test Steps:
To execute test cases, you need to perform some actions. So write proper test steps. Mention all the test steps in detail and in the order how it could be executed from the end-user’s perspective.
- Enter Username
- Enter Password
- Click Login button
Step #5 – Test Data:
You need proper test data to execute the test steps. So gather appropriate test data. The data which could be used an input for the test cases.
- Username: firstname.lastname@example.org
- Password: SOFTANS
Step #6 – Expected Result:
The result which we expect once the test cases were executed. It might be anything such as Home Page, Relevant screen, Error message, etc.,
Example: Successful login
Step #7 – Post Condition:
Conditions that need to achieve when the test case was successfully executed.
Example: Gmail inbox is shown
Step #8 – Actual Result:
The result which system shows once the test case was executed. Capture the result after the execution. Based on this result and the expected result, we set the status of the test case.
Example: Redirected to Gmail inbox
Step #9 – Status:
Finally set the status as Pass or Fail based on the expected result against the actual result. If the actual and expected results are the same, mention it as Passed. Else make it as Failed. If a test fails, it has to go through the bug life cycle to be fixed.
Other important fields of a test case template:
Project Name: Name of the project the test cases belong to
Module Name: Name of the module the test cases belong to
Reference Document: Mention the path of the reference documents (if any such as Requirement Document, Test Plan, Test Scenarios, etc.,)
Created By: Name of the Tester who created the test cases
Date of Creation: When the test cases were created
Reviewed By: Name of the Tester who created the test cases
Date of Review: When the test cases were reviewed
Executed By: Name of the Tester who executed the test case
Date of Execution: When the test case was executed
Comments: Include value information which helps the team
Best Practices To Write Good Test Case
Characteristics of a good test case are
- Easy to understand and execute
- Create Test Cases with End User’s perspective
- Unique Test case Identifiers must be used. It allows us to track them easily.
- Prerequisites should be listed clearly. Helps to execute the test case without any issues.
- Test data should be defined to evaluate each functional area.
- Test case description should be concise.
- Test Steps should be in detail and clear.
- Specify the exact expected result.
- Position condition should be listed if any.
- Test cases should neither too simple nor too complex.
- Test cases must be distinctive. There should not be no repeated test cases.
- Test cases should be written by following test case design techniques.
- Test cases must be comprehensible. So that any tester (even a newly appointed testers) can understand them by perusing once.
- Needs to provide clear environment details where we need to execute them.
- Test cases should be reusable & maintainable
- Get peer review.
If you follow the best practices to write test cases then anyone in the team can understand and execute the well-written test case easily. It should be easy to read and understand, not only for whoever wrote it but also for other testers as well.
Easy to understand and execute:
To make the test cases easy to understand and execute faster we need to use simple and easy to understand language like “Go to login page”, “enter username”, “enter password”, “click on login button” and so on.
Create Test Cases with End User’s perspective:
Create test cases by keeping end-user in mind. The test cases you create must meet customer requirements.
Use unique Test Case ID:
It’s good practice to follow a unique id with some naming convention for better understanding and discrimination purposes.
Have a clear description:
Your test case description should be clear enough to understand what the tester is going to do with this test case.
Add proper preconditions & postconditions:
In some cases, test cases need to meet some conditions before execution or achieve some conditions after execution. These conditions we need to mention properly in the Pre and postconditions.
Specify the exact expected result:
Include the Expected result: Expected result tells us what will be the result of a particular test step. Testers decide the pass or fail criteria based on the expected result.
Test cases should be reusable & maintainable:
A well written test case is reusable and maintainable. There ar times where developers change the code, and testers need to update the test cases. If our test cases are easy to read and understand then it would be easy to update them not only by whoever wrote it but also by other testers as well.
Utilize testing techniques:
Use testing techniques whenever necessary. Software test design techniques are used to derive the test cases from the Requirement Specification document and also based on testers expertise
- Equivalence Partitioning
- Boundary Value Analysis
- Decision Table
- State Transition
- Exploratory Testing
- Error Guessing
Get peer review:
Let your peers review your test cases to uncover the defects in your test case design.
Popular Test Case Management Tools
some of the popular tools for the test management process are
- Test Rail
- Test Collab
- Meliora Testlab
For more Blogs Click here
Excellent post. I definitely appreciate this website. Thanks!