WEBINAR: Building Test Automation Projects that Scale with TestOps REGISTER NOW

Test Suites and Their Test Cases: The Hierarchy Explained

We'll open the post by defining "test case." You'll see examples of test cases both in manual and automated software…

By Testim,

We’ll open the post by defining “test case.” You’ll see examples of test cases both in manual and automated software testing. After that, we’ll cover the term “test suite.” You’ll come to understand what it is, see examples, and learn how this concept relates to test cases. Before wrapping up, we’ll also cover yet another related term, “test run.” After you’re done reading the post, you’ll have a more robust understanding of these important concepts in the software testing field. Let’s begin.

Test Suites and Test Cases: What’s the Difference?

We can describe the relationship between test suites and test cases straightforward: A test suite is a collection of test cases. But what is a test case? Think of a test case as the smallest unit in the hierarchy of a testing approach. If that doesn’t make a lot of sense, don’t worry, we’ll explain both terms in more detail next.

What Is a Test Case?

We said you could think of a test case as the most basic part of a software testing approach’s hierarchy. A test case is what most people would consider “a test.”

What does a test case include? At the minimum, a test case has a sequence of steps that need to be carried out during the test execution. Executing a bunch of steps isn’t enough. The test case also needs to contain some verification in which the expected outcome is compared to the actual result. The result of that comparison is what will tell you whether the test has passed or not.

Expand Your Test Coverage

Fast and flexible authoring of AI-powered end-to-end tests — built for scale.
Start Testing Free

An Example of a Manual Test Case

Regular readers of this blog will know that we’re champions of test automation. That doesn’t mean we’re 100% against manual testing. Quite the contrary: Manual testing still has a role to play in a well-balanced testing strategy. Let’s see an example of what a manual test case could look like.

Since we’re talking about manual testing, that means that this test case must consist of steps with enough detail that a tester—or whoever is performing the test—should be able to carry it out without much problem.

For our test case example, let’s use a website we’ve used in the past: the demoblaze.com demo site:

Since this is an e-commerce site, testing the shopping cart functionality is of paramount importance. So, here’s what a manual test case for that could look like:

Test Step Expected Outcome Obtained Outcome
Access the URL https://demoblaze.com The “Demo Blaze” site should be displayed on the browser.
On the Categories menu on the left, click on Laptops. The product listing should be updated, displaying only laptops.
Click on the first product (Sony VAIO i5) The product’s details page should be displayed.
Click on the Add to cart button. The window should display an alert saying “Product added.”
Click on the Cart option on the main navigation menu. The cart page should be displayed, showing the laptop as the only product in the cart. It should display the picture of the laptop, its description (Sony VAIO i5), its price ($790), and a link to delete the item. The cart total should be displayed as $790.

An Example of an Automated Test Case in JavaScript

What does a test case look like when it comes to automated testing? Well, it really depends on what type of testing we’re talking about. If we’re talking about end-to-end testing, for instance, a test case could refer to a single testing session capture by a record-and-playback tool.

What if we’re talking about unit tests? In this case, we could think of a single test method as a test case. The following code example shows a unit test in JavaScript, written with the Jest framework:

What Is a Test Suite?

Having defined what a test case is and given examples, we’re ready to tackle the next term.

In short, we can say a test suite is a collection or container of many test cases related to each other. Grouping your test cases into adequately named suites makes it easier to manage them. You can group tests into suites according to several criteria:

  • by type of test (e.g., integration tests vs. unit tests)
  • by execution time (e.g., slow vs. medium vs. fast running tests)
  • finally, by modules or areas in the application

What a test suite looks like in practice will depend on the type of testing. If we’re talking about manual, scripted testing, a test suite can be as simple as a folder containing word documents, or it can be a more sophisticated approach. In the context of a unit test framework, a test suite can be a class, module, or another code artifact meant to group a bunch of unit tests.

What About a Test Run?

Before closing the post, we’ll cover a final term related to testing, “test run.”

A test run is an execution of one or more test cases. A test run is the moment of truth when all testing efforts are realized. After creating your test cases and grouping them into test suites, you must decide which tests will be executed. To do that, there are many different criteria you can use to decide. You might need to run only the test related to the most recent features. Or maybe, during the nightly build, you might want to run the integration tests along with the slower portion of the unit tests. You might decide to either test only the happy flow test cases or the sad flow ones, or both. If you work in a highly regulated industry like finance, you might need to run certain test cases to prove compliance with regulations.

A test run is all about deciding which test cases are to be executed and then making sure they’re run.

Grouping Your Tests Into a Test Suite: The First Step Toward Scaling Your Test Automation Approach

In this post, you’ve learned the definitions of the terms “test case” and “test suite,” in addition to learning the relationship between the two concepts. As you’ve seen, a test case is the most basic part of a testing approach. A test suite, on the other hand, is a collection of test cases. You group your test cases into suites to make it easier for you to manage them.

That becomes particularly important when your organization is a fast-growing one. It might be easy to manage a testing strategy when you have few people who create few tests. As your company starts to grow and you start to onboard more new people, the number of test cases can increase dramatically, in which case managing them can become quite challenging.

If that’s the situation you find yourself in—that is, needing more organization in your testing strategy—TestOps might be the answer you’re looking for. TestOps or testing operations is the discipline of managing the testing processes and people for maximum efficiency. It helps you deliver high-quality applications fast while allowing your organization to grow in a healthy, non-chaotic way.

What to read next

What is TestOps?

Codeless test automation: a complete introduction

No code, low code, coded: what’s the difference?

 

Testim's latest articles, right in your inbox.

From our latest feature releases, to the way it impacts the businesses of our clients, follow the evolution of our product

Blog Subscribe