Test Cases
In the last session, we had discussed about Test Scenario, which is one of the testing terms, and in this session, we are going to discuss another Testing Term which is Test Cases.
What is a Test Case
Test Case is an extended form of Test Scenario
Test Cases are more detailed description of a Test Scenario in a step by step manner on how to test a Test Scenario.
Test Scenarios are just one liner statements whereas Test Cases are detailed explanation of Test Scenarios.
Test Cases is set of Steps, inputs and expected result.
A test case typically includes information such as the test case ID, the test case description, the test input data, the expected output, and any other relevant information necessary to execute the test successfully.
How to write a Test Case
We need to follow some steps when we are writing Test Cases, First of all We should know that Test Cases are derived from Test Scenarios.
- We need to go through each and every Test Scenario.
- We have to write Test Cases for each and every Test Scenario.
- Test Cases is set of Steps, inputs and expected result, So we have to write the steps, input and expected result for the Test Scenario in order to covert it to a Test Case.
So, This is how, We write a Test Case.
Test Case Format
Below is the format of a typical Test Case.
We had written some Test Scenarios in our last session for a Calculator Application, So we are going to write Test Cases for few of those Scenarios here.
Test Name or Test Case Description | Step No | Description of the Step | Expected Result |
Add 2 Numbers | 1 | Launch Calculator Application on the Desktop | Calculator App is launched successfully |
2 | Type a number say 2 | Number is entered | |
3 | click on + sign | (+ Sign is clicked) | |
4 | Type a number say 3 | Number is entered | |
5 | click on = sign | Result of the addition is displayed which is 5 | |
Add 3 Numbers | 1 | Launch Calculator Application on the Desktop | Calculator App is launched successfully |
2 | Type a number say 2 | Number is entered | |
3 | click on + sign | (+ Sign is clicked) | |
4 | Type a number say 3 | Number is entered | |
5 | click on + sign | (+ Sign is clicked) | |
6 | Type a number say 4 | Number is entered | |
7 | click on = sign | Result of the addition is displayed which is 9 |
Now, Let’s write the Test Cases for eCommerce Application, for which we had written Test Scenarios in our last session.
Test Name or Test Case Description | Step No | Description of the Step | Expected Result |
Test the search functionality for Jeans and verify PLP Page displays only Jeans Products | 1 | Launch eCommerce Website | eCommerce Website is launched successfully |
2 | Search for Jeans | Validate PLP Page displays Jeans Products only | |
Test the PDP Page displays correct product description, pricing information, size and color information for a product | 1 | Launch eCommerce Website | eCommerce Website is launched successfully |
2 | Search for Jeans | Validate PLP Page displays Jeans Products only | |
3 | Click on any of the Product | Validate PDP Page displays with correct product description, pricing, size and color information of the product |
So, This is how, we write Test Cases.
Difference between Test Scenario and Test Case
Below are few differences between Test Scenario and Test Case
Test Scenarios | Test Cases |
Test Scenario is High Level Documentation | Test Case is a very detailed Documentation |
Test Scenario is a 1 liner Statement | Test Case contains many steps and many other components such as Test Name, Description of the Steps and Expected Result. |
Test Scenario is derived from Requirement | Test Case is derived from Test Scenario |
Test Scenario doesn’t contain data | Test Case contain data to be tested |
Test Scenario is all about what to test | Test Case is about what to test and how to test |
It takes less time to prepare Test Scenarios | It takes more time to prepare Test Case |
Test Scenario cover a broad range of functionality | Test Case is very specific while checking a functionality |
Best way to write a Test Case
- Test Case should be simple. We should write it in simple plain English language with clear description and expected result.
- Don’t Repeat the Test Case.
- Ensure 100% Coverage.
- Test Case Name should resemble with Functionality.
- Write test Cases using Software Testing Technique.
Summary
We have discussed below topics today
- What is Test Case
- How to write Test Case
- Test Case Format
- Difference between a Test Case and Test Scenario
- Best way to write a Test Case
Question
Write Test Cases for all the Test Scenarios, We have discussed in our Test Scenario Session.