How To Write The Perfect Test Case Template With Examples?
To know how to write test cases first let’s look at what is a test case. Furthermore, we will discuss the test template in detail including the test scenario template, test case template excel, QA test plan template, and many more. So let’s begin!
What is a test case template?
A test case template is a report that arrives under one of the test artifacts, which enables testers to formulate the test cases for a specific test scenario to verify whether the characteristics of an application are working as aimed at or not. Test cases are the pair of positive and negative executable phases of a test scenario which has a set of pre-conditions, required outcomes, test data, post-conditions, and real results.
Most of the firms are utilizing test case management tools like Quality Center, JIRA, etc., and few of the companies are still consuming excel sheets to write test cases. Now let’s look at the difference between test scenarios and test cases.
Test scenario: The test Scenario provides the concept of what we have to test. It is like a high-level test case. For instance: you verify the login functionality of the Gmail account.
Suppose we require to write test cases for a scenario let’s say to verify the login of the Gmail account.
Then there are the following test cases below:
- Enter valid User Name and valid Password
- Enter valid User Name and invalid Password
- Enter invalid User Name and valid Password
- Enter invalid User Name and invalid Password
Who writes test cases?
Well, to know who writes test cases as it differs from company to company. Assuming that a group includes developers and dedicated testers then it probably is something like a joint effort.
Following are the list below:
- Developers write Unit Tests
- Developers and Testers write Integration Tests
- Testers write Acceptance Tests
- Common Test Case Template Format
As we know what the test case is and who wrote it, let’s dive into the concept of how to write it in manual testing.
To write test cases in manual testing
Follow the below-given steps to write the test cases.
Step 1 – Test Case ID:
Each test case should be illustrated by a unique ID. It’s a decent practice to follow some naming tradition for better understanding and discrimination goals.
Step 2 – Test Case Description:
Select test cases appropriately from the test scenarios
Test scenario: Verify the login of Gmail
Test case: Enter an accurate username and reasonable password
Step 3 – Pre-Conditions:
Conditions that are required to fulfill before implementing the test case. Mention if any preconditions are accessible.
Example: Required a valid Gmail account to do login
Step 4 – Test Steps:
To execute test cases, you require to perform a few actions. So write adequate test steps. Mention all the test steps in detail and the order of how it could be implemented from the end user’s opinion.
Click Login button
Step 5 – Test Data:
You require adequate test data to implement the test steps. To collect appropriate test data. The data could be utilized as information for the test cases.
Username: [email protected]
Step 6 – Expected Result:
The outcome which we require once the test cases are implemented. It might be anything such as Relevant screen, Home Page, Error message, etc.,
Example: Successful login
Step 7 – Post Condition:
Conditions that require to be achieved when the test case is successfully implemented.
Example: Gmail inbox is shown
Step 8 – Actual Result:
The result which the system indicates once the test case is implemented. Capture the conclusion after the execution. Based on this result and the expected outcome, we set the status of the test case.
Example: Redirected to Gmail inbox
Step 9 – Status:
Ultimately set the status as Pass or Fail founded on the expected result against the actual outcome. If the real and expected results are the same, remark it as Passed. Else make it as Failed. If a test fails, it has to move through the big life cycle to be fixed.
Other significant fields of a test case template:
Project Name: Name of the project the test cases relate to
Module Name: Name of the module the test cases relate to
Reference Document: Mention the way of the reference documents, if any like Test Plan, Requirement Document, Test Scenarios, etc.
Created By: Name of the Tester who built the test cases
Date of Creation: When the test cases were built
Reviewed By: Name of the Tester who built the test cases
Date of Review: When the test cases were studied
Executed By: Name of the Tester who implemented the test case
Date of Execution: When the test case was implemented
Comments: Include value data which enables the team
Best practices to write a good test case
A well-written test case should:
- Easy to understand and execute
- Create Test Cases with End User’s perspective
- Use unique test case id
- Add adequate pre and postconditions
- Specify the exact expected result
- Test cases should be reusable and maintainable
- Utilize testing methods
- Get peer review
If you pursue the best exercises to jot down test cases then anyone in the team can comprehend and enforce the well-written test case effortlessly. It should be simple to read and understand, not only for whoever built it but further for other testers as well.
Easy to understand and execute:
To create the test cases simple to understand and implement quicker we need to use simple and easy to understand language like “Go to login page”, “enter username”, “enter password”, “click on login button” and many more.
Create Test Cases with an end user’s perspective:
Create test cases by maintaining the end-user in mind. The test cases you build must fulfill consumer requirements.
Use unique Test Case ID:
It’s a good exercise to follow a unique id with some naming tradition for better understanding and discrimination goals.
Add adequate preconditions and postconditions:
In some cases, test cases require you to fulfill some conditions before implementation or achieve some circumstances after execution. These conditions we require to mention appropriately in the Pre and postconditions.
Specify the exact expected result:
Involve the Expected result: Expected conclusion tells us what will be the conclusion of a specific test step. Testers decide the pass or fail standards based on the expected outcome.
Test cases should be reusable & maintainable:
A well-written test case is reusable and maintainable. There are times where creators change the code, and testers are required to update the test cases. If our test cases are simple to examine and understand then it would be easy to update them not barely by whoever wrote them but further by different testers as well.
Utilize testing techniques:
Utilize testing techniques whenever crucial. Software test design procedures are utilized to develop the test cases from the Requirement Specification document and also established on the tester’s expertise:
- Equivalence Partitioning
- Boundary Value Analysis
- Decision Table
- State Transition
- Exploratory Testing
- Error Guessing
Get peer review:
Allow your peers to review your test cases to disclose the flaws in your test case design. The prominent test case management tools, some of the common tools for the test management procedure are:
- Test Rail
- Test Collab
- Meliora Testlab
As of now, you have learned everything about the test case template so we wish you to have great test template writing. And if you have any queries do not hesitate to contact us. Hope you liked it.