Table of Contents
Recently we have covered the test plan and we did quite a good job doing it. The document itself covers the testing process quite thoroughly. We agreed that the core of the test plan are the test cases and test suites. Now let’s shift our focus a bit more on the test cases and test scenarios and as a bonus we will come back to the test suites for a moment or two.
Both test cases and test scenarios are crucial components of the testing process. Unfortunately it is not uncommon that they are not defined and understood properly. Also it happens that they are confused with each other. The ability to set them apart is very important for proper test execution. Each tester, QA, test manager should have this knowledge. We think a high-level understanding would be beneficial even for the business people as well. We will try to be professional but not too technical in this article so hop on board.
Test scenario shows a specific use case of a given functionality. It can be written in a non technical way as it describes an expected (positive and negative) result of a high level action. What is also significant for a test scenario, is that it might touch multiple layers of your software. If we were to create a smooth definition, we would aim for something like the following.
A test scenario is a described pattern of a positive or negative action performed by the software’s user.
Remember our article on test plans? Let’s use the same example app to create an example of a test scenario.
“Only an authenticated user can see the salary on a job posting subpage”.
This is a great example, because one simple sentence describes triggering multiple functionalities. This test scenario contains a basic action that the user may perform on the web application. There are multiple processes and actions involved.
What does the user see instead of the salary? If the user is not logged in, does he/she see the login button or link? Does the authentication work properly? Finally, when the user does log in after moving from the job posting subpage, is he/she redirected back to the same subpage after authentication?
We can go on and on about that one, but hopefully you get the point now.
There is a few additional key information here.
Test scenarios can not be automated and are not really reusable. They cover multiple aspects of your software and may include many variables.
A test scenario may be prepared by a technical as well as non-technical person. Usually the business people will tell what the app should do, and then the developers will have to know how to achieve it. It is the same in testing.
Test scenario covers the end to end functionality of the software that needs to be tested.
Remember that test scenarios may come from outside your testing team, it is common that some scenarios are derived from use cases that happen after the app is complete. The final users are great in finding ways of "breaking" your app. Ways that you would have never thought of. Best practice alert! If it is sound from the business perspective - foresee a beta test period for your app.
Can you perform software testing just based on a test scenario? No, you need to be more thorough. That is why you need something more detailed. You need a...
A test case lets the tester know how to test a given feature of your app. We have to emphasise the singular here. The rule of thumb is one feature - one test case. Test cases are derived from test scenarios. It will usually include some input and expected result. Most test cases are written by and for a technical person, so expect more programmers’ vocabulary than it was in the test scenario. Our definition of a test case follows:
A test case is a set of instructions, inputs and expected outcomes that is needed to validate the proper functionality of one software feature.
Some technical knowledge and understanding the subject matter of your software are necessary to write test cases. As stated in the definition, we do not only need to describe what needs to be tested. We also need to know what is the data we want to use and what is the expected outcome.
Let’s jump right in and try to produce a test case from the test scenario above.
Test case #1 - verify if the salary is hidden in a job post
- Go to “/ads/job/2” url
- Scroll to div with id = “salary”
- Expected outcome is “Please log in to see full details” with “log in” being a link to “/login” url
- Failure condition is “$100 per week”
- Report any different outcome
As you can see there are a few different elements that make a test case. The case ID - just for clarity. The case name or title if you will - a brief description of what is being tested. Last, but not least there are the test steps for the test engineer.
Such test cases are easy to reflect in test automation tools. Some of them, like BugBug, will even enable you to create many test cases with using little to no code with their drag and drop functionalities.
The difference between Test case and Test scenario in software application testing
Trying to compare a test case and a test scenario is like trying to compare a book and a page. One could exist without the other but you have to agree that one page will never give you the whole context, right? It is the same for test scenario vs test case recognition.
In software testing it is quite tricky to find actual similarities between scenarios and cases. They both serve a testing purpose, have a designed scope and purpose. The key is not to confuse them. A testing scenario describes user behaviour and may (should actually) be transformed into a list of technically defined single test cases.
Let's focus on the key differences to have a better understanding what a test scenario and test case is.
|Test scenario||Test case|
|Everyone related to the project can write test scenarios||Technical personnel is responsible for creating test cases and performing the test|
|A test scenario covers end-to-end behaviour of the user what can go across multiple functionalities||Test case contains one single functionality to be tested|
|Is created with no possibility of reuse or automation; includes many variables and is not a procedure||Is reusable and easily adaptable for test automation|
|Informs what needs to be tested||Informs how to perform every test|
|Strategically overviews how the users will be using the software||Gives some structure to the testing process|
If we were to simplify the matter as much as we can, remember this. A test scenario is basically a set of test cases. There can be one or many test cases for a single test scenario.
How to write Test cases and Test scenarios?
After the first few paragraphs we are sure that you are a person clearly understanding what a test case and a test scenario is. Creating test scenarios is easy for people with a high level overview of the software whereas test cases are easier for people with more experience in the software testing field. Whichever description suits you more, it is crucial to stick to the how / what division.
You should not overthink while creating a test scenario. Take the easiest approach possible and become the user for a moment. Think of what you would like to do in your app and then write it down. It should be that easy. Try not to consider (and describe) what different functionalities would your scenario trigger. This is for the test cases to check.
When you are creating test cases for each scenario, your job will be a lot more thorough. We suggest the "from the general to the particular" approach.
Once you have the test scenario, try thinking about what functionalities it triggers and list them down. Afterwards analyze how those functionalities should and should not behave under the circumstances given in the scenario. Then provide or mock the data that need to be used in the testing effort. Last but not least, define the positive and negative outcome of each test.
For starters try using our template from this article. We do encourage you to experiment and adapt such templates for your testing environment. Remember that creating test cases is a one-time job, an investment if you will. They are the core of test automation and are easily reusable throughout the testing process.
Test case vs Test scenario - summary
At the very beginning we promised adding the test suite into the equation. Thanks for sticking around for that one. In our last article we described the test suite as a set of test cases. Here we do the same for a test scenario. There is a key difference though.
A test suite is a set of test cases relevant to each functionality and is an artificial entity that helps to manage the testing process. Whereas a test scenario can cover multiple functionalities and is an effect of natural user actions performed in the app.
They both cover multiple test cases, but a test suite can be automated whereas test scenario can not.
We hope we were able to convince you that test scenario and test case are two completely different beings used during the testing of an application. The scenario focuses more on the "what" and the case focuses on the "how". Remember that test cases are derived from test scenarios and not the other way around. From the good practice perspective it is wise to encourage your users to beta test as they have much more creative ideas on how to break your app.
Happy (automated) testing!