I’ve been involved in software testing for over 15 years and I love it.
Not just helping with building better quality software but educating and teaching others about this industry.
However, there’s a few things over the years I’ve found that never go away.
Terminology seems to still be a big issue with no two organisations using the same.
This seems to be true when talking about test artefacts.
In this article I’m going to identify key differences between a test case and test scenario in order to help you understand which one you might need for your next testing project.
If you’re interested in becoming a software tester then please have a read of the article.
So What’s The Definition
What’s funny is that at the time of writing this (Feb 2023), there isn’t an official definition of the term “test scenario” by the ISTQB.
That makes things a bit more interesting since it’s a very popular term used within the testing community.
A test scenario is a high-level description of what needs to be tested, while a test case is a specific set of steps that needs to be executed to verify a particular aspect of the system.
Understanding Test Cases
I would describe a test case as a set of instructions that describe the steps to be taken to test a particular feature or functionality of a software application.
Your test case will allow you to hone in on specific lower level functional requirements / test conditions which may be part of your test suite.
Test cases may be derived from a test scenario.
Your test case will contain the following attributes;
- test case ID – a unique identifier to help identify the document.
- Execution preconditions – conditions or requirements that MUST be met prior to executing a test case. This may cover environmental or test data conditions as an example.
- Test condition – describe the environment/situation under which the test will be conducted.
- Test steps – describe the detail and sequence of each test step that needs to be executed.
- Expected results – the outcome you envisage as a result of running the test step.
- Execution postconditions – Expected outcomes or results that should occur after a test case has been executed. This will help to understand if the test case has met its objectives. “Actual Result” is an example of a column you must have in your test case template.
If you’re looking for more detail, you might be interested in learning about how to write a test case.
Understanding Test Scenarios
Think of a module or a component that you want to test end to end at a high level without going in depth.
A test scenario is a high-level description of a particular functionality or feature.
Test scenarios are a good way to test end to end functionality that mimic real life situations for an end user.
Test scenarios are also a good way to understand system behaviour and usability.
Your test scenario may contain a multitude of test cases for the requirements you want to validate.
I typically use test scenarios to help me understand the high level functionality of the application before I start to build out the test cases.
Differences Between Test Cases and Test Scenarios
Test scenarios are usually less detailed than test cases.
They provide a broad overview of what needs to be tested and the expected outcome, whereas test cases are much more detailed, specifying the exact inputs, expected outputs, and steps to be taken to carry out the test.
A test scenario typically covers a larger scope, encompassing multiple test cases, whereas a test case is specific to a single test.
Test scenarios are designed to ensure that all the different aspects of a feature or functionality are covered by multiple test cases.
Test cases are usually dependent on test scenarios.
Test scenarios provide a high-level overview of what needs to be tested, while test cases are used to verify specific aspects of the system in greater detail.
Test cases in many cases are automated, while test scenarios are usually not.
Automated test cases are used to verify specific functions or behaviours of the system, while test scenarios are more often used as a guide for manual testing.
Below is a table that highlights more comparisons.
|Test Cases||Test Scenarios|
|Hierarchy||Low Level coverage||High Level coverage|
|Purpose and Objective||Used to test individual features or functionalities of the software||Used to test multitude of test cases together to ensure software works as expected|
|Scope and Coverage||Narrow scope and cover specific aspects of the software||Have a broader scope that cover multiple features or functionalities of the software|
|Level of Detail||Are more detailed than test scenarios, as they describe the exact steps to be taken to test a particular feature or functionality.||Are less detailed and provide a high-level overview of the testing process.|
|Dependencies and Preconditions||Have dependencies and preconditions that must be met before they can be executed||Do not have dependencies and preconditions, as they are used to test multiple test cases together.|
|Expected Results||Have expected results that are defined beforehand||Do not have predefined expected results|
|Reusability and Maintainability||Are easier to reuse and maintain than test scenarios||Require more maintenance, as they cover multiple test cases, making them more complex|
|Domain / Business Knowledge||You may not require in-depth business knowledge from the outset and will be able to design test cases if you have the specification documents.||You will require a certain level of knowledge of how the business operates and plans to use the software when creating high level test scenarios.|
When to Use Test Cases vs. Test Scenarios
As part of your test planning activities, you’ll need to figure out which approach you need to use.
Below are some factors you might want to consider.
Choosing the right approach
When determining whether to use a test case or test scenario, it’s essential to consider the scope, purpose, and objectives of the testing effort.
Factors to Consider
Some factors to consider include the complexity of the application or feature being tested, the level of detail needed to test effectively, the availability of resources, the time available for testing, and the desired test coverage.
Some Examples of when to use test cases against test scenarios
I know you love an example so let me try to give you an understanding of when you’ll need to use these particular artefacts.
When your testing effort requires more in depth testing, for example low level functional integration testing, test cases will be more appropriate.
This is because they provide more detailed instructions and you will be able to prove out lower level requirements.
In situations where testing is more exploratory or focussed on high level functional areas, test scenarios will be more appropriate.
This is because it allows you as a tester to create a more comprehensive test plan without getting bogged down in the details.
Some of you may be familiar with the term “one liners” which could be your test scenarios.
Examples of Test Cases vs Test Scenarios
In the example below, the test scenario covers the high-level steps for registering a new user, while the test case focuses specifically on verifying the email validation on the registration form.
Both the test scenario and test case are necessary for thorough testing of the registration form.
The test scenario provides the context and guidance for testing the feature, while the test case provides the detailed steps for verifying specific functionality within that feature.
|Example #||Context||Test Scenario Example||Test Case Example|
|Example 1||Context: Testing a registration form on a website||Test Scenario: Registering a new user|
Description: This scenario covers the high-level steps to be taken to register a new user on the website.
Navigate to the registration form.Enter valid details for a new user, including name, email address, and password.Click on the “Register” button.Verify that the user is redirected to the login page.
|Test Case: Verifying email validation on the registration form|
Description: This test case focuses specifically on verifying that the email validation on the registration form is working as expected.
The user is on the registration form.The email field is empty or contains an invalid email address.
Enter an invalid email address (e.g., “[email protected]”).Click on the “Register” button.Verify that an error message is displayed indicating that the email address is invalid.Enter a valid email address.Click on the “Register” button.Verify that the user is redirected to the login page.
|Example 2||Context: Testing a search feature on an e-commerce website||Test Scenario: Searching for a product by keyword|
Description: This scenario covers the high-level steps to be taken to search for a product on the website using a keyword.
Navigate to the search bar.Enter a keyword related to the product.Click on the “Search” button.Verify that the search results page is displayed, and it contains the relevant products.
|Test Case: Verifying search results with multiple keywords|
Description: This test case focuses specifically on verifying that the search feature can return the correct results when multiple keywords are used.
Preconditions:The user is on the search bar.Multiple keywords have been entered in the search bar.
Steps:Enter multiple keywords in the search bar.Click on the “Search” button.Verify that the search results page is displayed, and it contains the relevant products that match all the keywords entered.Verify that the search results are ordered based on relevance to the entered keywords.
|Example 3||Context: Testing a login feature on a mobile application||Test Scenario: Logging in to the application|
Description: This scenario covers the high-level steps to be taken to log in to the mobile application.
Launch the application.Enter valid login credentials, including username and password.Click on the “Login” button.Verify that the user is redirected to the home screen.
|Test Case: Verifying login with incorrect password|
Description: This test case focuses specifically on verifying that the login feature can detect and handle incorrect passwords.
Preconditions:The user is on the login screen.The password field is empty or contains an incorrect password.
Enter an incorrect password.Click on the “Login” button.Verify that an error message is displayed indicating that the password is incorrect.Enter the correct password.Click on the “Login” button.Verify that the user is redirected to the home screen.
Visualising Your Test Case vs Test Scenario
I’ve tried to illustrate how I would typically create test cases derived from test scenarios.
Lets assume you are testing a small to medium size system with several thousand requirements.
- Acquire baselined specification documents
- Input all requirement details into your Requirements traceability matrix (RTM) so you have a golden source.
- Filter by specific high level areas of functionality / components etc.
- Start thinking of high level scenarios. Consult the business and your stakeholders if required.
- For each scenario, start to build out detailed test cases.
- Governance Tip: Ensure you map all your test case IDs back to the RTM to trace coverage.
Being Efficient with your Test Design
Remember that exhaustive testing isn’t really something you want to do. It’s time consuming, expensive and a real overhead.
My idea of writing a good test case would be to prove your requirement with the least amount of steps, maximum coverage and to build confidence.
If you have a large number of test cases, writing optimised test cases will make your test execution phase more efficient. Even if you employ a test automation strategy, think of how much quicker things can get done.
Even better when its time for regression testing.
I hope I’ve given you some clarity on the differences between a test case and test scenario.
My suggestion is to firstly ensure that your organisation uses consistent testing terminology.
Engrain it into everyone, including non testing stakeholders.
Without this, there will always be confusion.
Overall, both test scenarios and test cases play important roles in software testing, and both are necessary for thorough testing of software applications.
Test scenarios provide a broad overview of what needs to be tested, while test cases provide the detailed instructions for carrying out those tests.