How to Write a Test Case: Format & Examples

Instructor: Saranya Ramachandran

Saranya has a Bachelors in Science focused on Electronics and Telecommunication and a Masters in Business Administration. She has 8 years of Project Management Experience and is PMP Certified.

Test case is a term used in the software development process to determine the various conditions or inputs to the software and the expected output for each input.

Why do We Need Test Cases?

Beth has created a new iPhone application that tells the best route between two locations by considering the traffic. She now wants to test out the application. Her friend Angie who is a software tester asks Beth to test it out by writing out some test cases. Test cases are needed to make sure the product or software developed meets the requirements. Once a product or software is developed, it needs to be checked to see if the goal of creating the software product is achieved. This is done through test cases. The test cases document the various scenarios and the expected output that the software should deliver.

Format and Example of a Test Case

A test case has certain elements to it. These are needed to write a well thought out case.

Let us see an example format of a test case.

  • ID or a unique identifying number- This is a unique ID assigned to each test case.
  • Objective- This explains the test case scenario in a short sentence.
  • Dependencies - Is the test case dependent on any other test case implemented already or would it impact any other test case?
  • Procedure - This explains how to actually perform the test.
  • Inputs - The data that needs to be put in.
  • Result as per requirement - The actual result that is expected.
  • Result delivered by the software - Sometimes the actual result may be different from what is expected. Hence, this element is important.
  • Status - This is the element which denotes whether the result of the test passed or failed.
  • Name of the person performing the test.
  • Date the test was performed.

Example of a Test Case

Let us consider the example of Beth's best route software application and a test case.

  • ID - We can create a simple ID such as 001.
  • Objective - To determine if the application gives the best route as the output.
  • Dependency - No dependency for this case.
  • Procedure - Open the application. Input the destination and the starting address and press on calculate the route.
  • Input - Starting address - 123 Banana Street, Fruit City.

Destination - 456 Carrot Street, Vegetable City.

To unlock this lesson you must be a Member.
Create your account

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use

Become a member and start learning now.
Become a Member  Back
What teachers are saying about
Try it risk-free for 30 days

Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account