Section divider

Writing Test Cases: Examples, Best Practices & Test Case Templates

By Dennis Gurock
15 min read
Writing Test Cases with Test Case Examples & Templates

Test automation is on everyone's lips these days, which is why you might be wondering if writing manual test cases is still relevant. For many teams the answer is a resounding Yes. While test automation is vital, writing test cases for manual testing is still important for many reasons.

Often times tests are just too complex and expensive to automate – manual testing can sometimes be more efficient and is often leveraged to prevent critical bugs in software from reoccurring. Automation is also still not suited for more creative and empathetic test approaches. And many companies simply don't have the expertise to turn their backs on writing test cases.

That's why manual testing is still a standard approach for software developers and testers, requiring proficiency in writing test cases and a place to manage them. Many companies utilize dedicated test management solutions for this purpose, while smaller teams often take the old-school approach with Excel spreadsheets. Regardless of the tool your team chooses, even the most modern test management app doesn't automatically make you a good test case writer.

So if you're looking to improve your test case writing skills, keep reading to learn from some of our test case examples and from best practices we've learned over time.

Why Writing Good Test Cases Makes a Difference

Before we get into the "how," let's first examine why you should care about writing good test cases in the first place:

  • Good test cases are easier to maintain. Writing test cases takes time. Consequently, if the system under test changes, you don't want to spend too much extra time updating them. Maintaining existing test cases should be as simple as possible – especially if you're not the test case author.

  • Good test cases are versatile. Nobody wants to update the entire test suite for every new feature release. Try to write nonspecific test cases that remain relevant after the system's user interface changes to save time and minimize errors in test cases caused by hasty updates.

  • Good test cases make you flexible. Finally, you can use the time saved in writing and managing test cases for other test methods, such as exploratory testing. This allows you to identify edge cases that need testing and ultimately ensure that your product delivers a great user experience.

Test Case Examples & Templates

Most importantly, a good test case should enable you to do your job as well as possible – regardless of the system under test or your test management solution.

Since many test management tools encourage testers to write overly detailed test cases, our examples should demonstrate that the quality of a test case doesn't depend on the number of fields you fill out. We sadly can't provide you with instructions on how to write the ideal test case for your specific scenario, but the examples below follow some of the best practices discussed later in this article.

Suppose we're developing a to-do app and need to test whether the UI correctly displays the results for creating, updating, and deleting to-do lists. Here's what some of these manual test cases could look like:

Title
Create to-do list

Description

  • Navigate to the Create new to-do list form
  • Fill in all fields with valid test data (see test data in attachment)
  • Submit form

Expected: The newly created to-do list detail page is loaded and shows all the specified data.

Attachment
test_data_new_todo_list.txt

Title
Update to-do list

Description
Context: The user has created a to-do list.

  • Navigate to the to-do list
  • Click Update
  • Fill in all fields with valid test data (see test data in attachment)
  • Submit form

Expected: The updated to-do list detail page is loaded and shows the newly entered data.

Attachment
test_data_update_todo_list.txt

Title
Delete to-do list

Description
Conext: The user has created a to-do list.

  • Navigate to the to-do list
  • Click delete
  • Confirm delete popup

Expected: The to-do list overview page is loaded, and the deleted to-do list is not listed.

Of course, this is not a complete test suite and we can think of various additional test cases for each scenario. However, these are some examples of nonspecific test cases that are quick to write and easy to maintain.

Let's look at another example. Imagine our to-do app had a bug in the past where the CSV export of a to-do list didn't result in a valid CSV file which caused a lot of issues for users.

We decide to write another test case to ensure that this bug doesn't reoccur with new app versions. In contrast to before, we want it to be more specific and yet as flexible and maintainable as possible:

Title
Verify CSV export RFC 4180 compliancy

Description
Prerequisites: The user has created a to-do list.

  • Navigate to the export page
  • Pick CSV as export file format
  • Submit export form
  • Open CSV file in a text editor

Expected:

  • The CSV file is downloaded to the computer
  • The CSV file is RFC 4180 compliant (see sample CSV in attachment)
  • The file content matches the to-do list data in the app

Attachment
RFC_4180_CSV.csv

5 Best Practices for Writing Manual Test Cases

Now, let's look at five best practices for writing test cases we've learned over time. Taking them to heart will help you write better test cases and improve collaboration between testers and developers.

1. Keep it simple and consistent

It's not only about what you write; it's also about how you write it. Using simple language and a specific writing style will help you write tests faster and make them easier for others to understand.

But making sure the entire team's on the same page here can be tricky. We therefore recommend creating and enforcing a style guide for writing manual test cases. This guide could define best practices, writing dos and don'ts, terms and abbreviations to use, the formatting of specific sections, and so on. Check out this Test Writing Style Guide from W3C to get an idea. You ideally define your own style guide based on your team's needs.

2. Start with a good test scenario

Writing good test cases is more straightforward when you have a good test scenario to begin with. And as you can imagine, poorly written test scenarios can negatively impact your test cases for several reasons. Let's look at a quick example!

Badly-scoped test scenario: Check user authentication functionality.

The problem with this scenario is that it doesn't define the test scope well. Should you write test cases for login, registration, and password reset? Suppose your colleague is working on a test scenario, "Verify user password reset," simultaneously. Now you're both writing the same test cases, wasting a lot of time.

Better-scoped test scenarios could be:

  • Verify user login functionality
  • Verify user registration functionality
  • Verify password reset functionality

If you properly scope your test scenarios, it'll be easier to differentiate between tests and work with several testers in parallel.

Test case details and results added during testing.

3. Only be as specific as needed

You've probably heard the saying that testing is about being precise. However, test cases that are too specific are often inflexible and difficult to maintain. Hence, we believe that test cases should only be as detailed as needed. They should adapt to system changes and allow testers a more flexible approach to their work.

Let's demonstrate this with an example. Suppose we have a chat app and are working on checking the Update username functionality. The test case below ensures that the username isn't updated if the input field is left blank:

Title
Check username update with empty username

Description
Prerequisites: Be logged in

  • Open the "Settings" page via the main navigation
  • Open the "My profile" settings page
  • Scroll to the "Update Username" section
  • Don't provide any input to the field "New username"
  • Submit the form by clicking the "Update Username" button

Expected:

  • Get message "Error: Username can't be empty."
  • Username does not update in Profile

But what happens if the UI changes in the future? What if the "Settings" page isn't linked in the main menu, pages and buttons are given a different label, or the "Update Username" section is moved somewhere else? Then we'd have to rewrite all of the steps to make sure they reflect the current state of the system under test. And we'd have to do that for many test cases, which takes a lot of time.

Opting for a more vague approach saves you this trouble:

Title
Check username update with empty username

Description
Prerequisites: Be logged in and be in the profile settings

  • Scroll to update username form
  • Leave username field empty
  • Submit the form

Expected: See an update failure message.

With this version, you wouldn't have to update the test case with every slight change in the UI, but testers can still understand what to do. As a result, you can concentrate on other, more pressing, or creative tests.

4. But know when to be precise

Do testers regularly run into problems with the vague description of a test case and end the test run with an incorrect result? Then you should try writing a more specific test case and see if the testers fare better. Depending on the test case's complexity, it may take a few iterations to find the suitable accuracy.

Test cases for delicate features that work with sensitive data like passwords or credit card information also often call for more preciseness – especially if you've served your users with bugs in these features before.

You may remember the uproar Apple's macOS caused in 2017 when anybody could unlock the system with the username 'root' and a blank password. To be sure that this error never happens again, the testers could write a test case that tries to reproduce this exact bug:

Title
Check login with empty password

Description

  • Start macOS
  • Click "other" on Login Screen
  • Enter username (data: root)
  • Enter password (data: empty)
  • Click enter twice

Expected: The login does not work and access is denied.

Not only can writing more accurate test cases help prevent known bugs, but it can also reduce the pressure software teams deal with by worrying less about delivering faulty software.

5. Encourage exploration

When you write down a list of test cases for your scenario, you're likely missing out on a few. Often you'll only recognize a test case when you encounter the corresponding error in your system. To address this, good testers invest time to freely explore features to discover new test cases and issues.

Not just that, but exploration also helps you discover a feature through your users' eyes and understand their needs and wants. Ultimately, this approach helps to improve the overall customer experience with your software, making you a more valuable tester for your company.

Again, the key is not to write test cases that are too specific:

  • "Navigate to the profile settings page." Instead of specifying the exact route, we let the tester decide how to get to the destination.
  • "Submit the contact form." A creative tester may have more than one idea of submitting a form – press the submit button, hit Enter on the keyboard, or even click the submit button of another form, etc.

The more you understand the system under test, the better you are at exploring it. In other words, you'll know what to look for and which aspects are more prone to errors. If you have time to explore, make the most of it and be creative.

Test cases and results in a test management tool (here: Testmo).

The Key to Writing Good Test Cases

Often times the key to writing good test cases is to know when to be specific and when not to. By following best practices and learning from test case examples, you can improve your test case writing skills and become a more effective tester.

Many effective software testing teams achieve their goals by combining manual test cases with test automation and exploratory testing. Keeping track of the various testing efforts and methods require efficient modern test management – especially if you're currently working with simple Excel sheets that are hard to maintain or if you use an older legacy system.

If that's the case for your team, you might want to consider looking for a dedicated test management tool such as our app Testmo that you can leverage for your testing strategy – now and in the future. Or review a list of the best test management tools to choose a tool for your projects.

But regardless of the tools you use, investing into becoming a better test case author and improving your manual testing skills is time well spent.

Start Testing with Testmo Free

#1 Modern Test Case Management Software

Test automation runs
Test automation command line

PS: We regularly publish original software testing & QA research, incuding free guides, reports and news. To receive our next postings, you can subscribe to updates. You can also follow us on Twitter and Linkedin.

Section divider
More from Testmo
We are excited to announce Testmo, our new modern test management tool for software teams. Today we are sharing the first details of the unified QA & testing platform we have been working on.
Read full article
Speed up your GitLab CI/CD pipelines and deployments by running your automated tests in parallel and improve your testing performance.
Read full article
Producing great looking screenshots for software marketing websites can be surprisingly difficult and time consuming. Check out our method to automate this repetitive task with code.
Read full article

Start testing with Testmo for free today

Unified modern test management for your team.