Try for Free
Menu
Try for Free

How to Write Test Cases (with Helpful Examples)

by Thijs Kok, on October 27, 2021

After investing so much time and money into your software development project, knowing how to write test cases may not seem like something that can make or break your product.

However, software testers knowing precisely what to test and expect as output is vital information your development team needs to finish their job.

So what makes a test case great, and what are some test case examples you can use to make your efforts more effective?

Here are some key qualities and test case management tools to take your test cases to the next level:

What Is a Test Case?

Before getting into what makes a great test case, it's essential to be on the same page about what exactly a test case includes.

At a high level, a test case is a collection of instructions a tester can use to determine if a function or feature is present in a piece of software or not. It either passes or fails the test in terms of its stated outcome.

Each test case consists of data to be used as inputs to the system, the steps to evaluate the particular function or workflow, the precondition, and an expected postcondition.

A positive test case result means the requirement has been met, whereas a failure means the development team needs to refine their design and retest until the expected outcome is verified.

Try TestMonitor for Free: See for yourself how your team can structure test  management and bring software quality to the next level.

Example Test Cases

Putting all these pieces together, a test case could then look like the following:

Example 1

ID

  • TC001

Name

  • Log in using an email and password.

Instructions

  1. Click on Login on the application page.
  2. Using the test data, fill in the email address and password.
  3. Click on Login.

Preconditions

  • You must be on the application start page.
  • You shouldn't be logged in.
  • The account must already be registered.

Expected Result

  • After logging in, you should be redirected to the application's dashboard.

Test Data

  • Name: John Doe
  • Email Address: j.doe@testmonitor.com
  • Password: <use password vault>

Example 2

ID

  • TC002

Name

  • Change the bank account with the correct number.

Instructions

  1. Go to the Maintain screen.
  2. Choose the tab Financial.
  3. Change bank account and confirm.

Preconditions

  • The bank account is valid.

Expected Result

  • The bank account is validated and changed.

Tips on Writing Test Cases for Software Testing 

Looks easy, right? 

As any experienced tester could tell you, the process of identifying and writing test cases is quite complicated—and managing them is even harder! Here are some helpful tips: 

1. Ensure every test case is identifiable and links to a defined requirement.

The purpose of testing is to validate that a specific technical or functional requirement is met in the final design. At the same time, you never know how many test cases your team will need to evaluate your final product.

That’s why it is essential to have unique test case IDs with a consistent, logical naming convention that aids in tracking and organizing cases. At the same time, each test case should identify which requirement(s) it is being evaluated against, allowing for the end-to-end visibility your team needs.

2. Write test case steps with an end user in mind.

In some cases, a tester may not have the same level of technical or functional knowledge as the design team. That’s why it is essential to use simple, clear, and logical language as test case steps are being drafted.

As seen in the examples above, action-oriented language reduces the chance of miscommunication that could delay the testing process.

3. Have clear expected results.

Ultimately, the result of a test case will be binary—it either passes or fails.

Make it easy for your testers to understand the result by clearly indicating the behavior or output the tester should experience if the test is successful.

4. Use a test case management tool.

Although every software design project is unique, the overall approach and best practices apply to each one.

One way to increase the productivity, consistency, and effectiveness of your testing is with a test case management tool. These tools help by:

  • Providing a test case library.
  • Offering customizable tester dashboards.
  • Easing test case design and management.
  • Making it simple for testers to record their results.

Take the Next Step

What’s better than being able to integrate all of these best practices for test cases into your testing phase? 

Utilizing a modern test case management tool that is constantly evolving to deliver more efficiency and impact to your projects.

As a result, your delivered software will be more secure, stable, and in line with client requirements, building even more trust in your brand and making the testing phase more productive.

Are you ready to see the power of TestMonitor for yourself? Click here for a customized free trial.

QA Testing: A Helpful Guide for Software QA Professionals

Download test management tool checklist

Want the latest news, tips and advice in next-level software testing? Subscribe to our blog!