Test Cases

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.

  1. We need to go through each and every Test Scenario.
  2. We have to write Test Cases for each and every Test Scenario.
  3. 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 DescriptionStep NoDescription of the StepExpected Result
Add 2 Numbers1Launch Calculator Application on the DesktopCalculator App is launched successfully
2Type a number say 2Number is entered
3click on + sign(+ Sign is clicked)
4Type a number say 3Number is entered
5click on = signResult of the addition is displayed which is 5
Add 3 Numbers1Launch Calculator Application on the DesktopCalculator App is launched successfully
2Type a number say 2Number is entered
3click on + sign(+ Sign is clicked)
4Type a number say 3Number is entered
5click on + sign(+ Sign is clicked)
6Type a number say 4Number is entered
7click on = signResult 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 DescriptionStep NoDescription of the StepExpected Result
Test the search functionality for Jeans and verify PLP Page displays only Jeans Products1Launch eCommerce WebsiteeCommerce Website is launched successfully
2Search for JeansValidate PLP Page displays Jeans Products only
Test the PDP Page displays correct product description, pricing information, size and color information for a product1Launch eCommerce WebsiteeCommerce Website is launched successfully
2Search for JeansValidate PLP Page displays Jeans Products only
3Click on any of the ProductValidate 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 ScenariosTest Cases
Test Scenario is High Level DocumentationTest Case is a very detailed Documentation
Test Scenario is a 1 liner StatementTest Case contains many steps and many other components such as Test Name, Description of the Steps and Expected Result.
Test Scenario is derived from RequirementTest Case is derived from Test Scenario
Test Scenario doesn’t contain dataTest Case contain data to be tested
Test Scenario is all about what to testTest Case is about what to test and how to test
It takes less time to prepare Test ScenariosIt takes more time to prepare Test Case
Test Scenario cover a broad range of functionalityTest Case is very specific while checking a functionality

Best way to write a Test Case

  1. Test Case should be simple. We should write it in simple plain English language with clear description and expected result.
  2. Don’t Repeat the Test Case.
  3. Ensure 100% Coverage.
  4. Test Case Name should resemble with Functionality.
  5. Write test Cases using Software Testing Technique.

Summary

We have discussed below topics today

  1. What is Test Case
  2. How to write Test Case
  3. Test Case Format
  4. Difference between a Test Case and Test Scenario
  5. Best way to write a Test Case

Question

Write Test Cases for all the Test Scenarios, We have discussed in our Test Scenario Session.

Leave a Comment