Let’s bake a test case

Maria Matyushenko
5 min readNov 25, 2020

--

Let’s bake a test case
Let’s bake a test case

It is this time of the year again. Winter is right behind the corner, the days are getting shorter, it is getting colder outside, and everyone is seeking warmth and comfort at home. What can be more comforting than a homemade cake?

One time when I was mixing batter for my favorite pumpkin spiced bread, I started thinking of similarities between test cases and recipes. They both have a title, steps, and expected results. They both can be understandable or misleading.

Let us consider the following components of a typical recipe and a typical test case and try to map them.

Recipe Title / Test Scenario

The title of a recipe is a short description of the final product. It must be clear to the reader, what will get out of the oven. It is usually specific, but brief, not overwhelming with details.

The test scenario is a brief summary of the test case and its objectives. Same as in the recipe, the reader wants to know what is the goal of the test case without getting into details.

Important here is to find this perfect balance between not enough and too much information. Let us look at a few examples. I am leaving you the right to decide which one is good or bad.

Recipe title #1. Apple pie.

Recipe title #2. Traditional Russian Apple Cake (Sharlotka) — Easy Recipe.

Recipe title #3. My neighbors asked for this recipe! How could I not know about it before? You will never stop baking this amazing cake!!!!!!!!

Test Scenario #1. Check login page.

Test Scenario #2. Verify that a user can login with a valid email/username and a valid password.

Test Scenario #3. Check that user can login to the website when he/she opens the login page and enters valid data and submits the form.

Required tools / Test environment and pre-requisites

I like to know which tools I will need to bake my cake. Whether I will need to use a stand mixer or whisk. Will I need to melt something on the stovetop, and will I need to preheat my oven to a certain temperature?

Same with a test case, I want to know the platform, where I am going to execute this test case. Is it designed to work only in the integration system? Or will my local development environment will do it too? Should I run this test in a particular browser with some specific settings? Or maybe I need some special software to be installed on my machine, before executing test steps? I want to get all these answers before I started the actual test execution.

Ingredient List / Test Data

This is such an important part of each entity! I believe you would agree, that before baking a cake, you want to have all the ingredients prepared, handy, and in the right measurements.

If you work with a test case, you want to know in advance which data you will need for testing. You do not want to discover in the middle of test execution, that now you have to prepare a big ‘csv’ file for the import, the same way, as you do not want to run to a grocery store in the middle of cooking.

It is usually clear with cooking, that the ingredients must be listed. But when it comes to testing, this step is ignored quite often. I highly recommend not to skip it in your test cases. Otherwise, your test case can end up over salted or under baked.

Recipe Steps / Test Steps

You can agree with me or not, but there is no test case if there are no test steps written. Unfortunately, I saw test cases with no steps at all or just a short sentence, which would not give me any information about test instructions.

Look at test steps as at recipe steps. Each step must describe actions the reader has to take to get to the desired result. Each step must have an expected outcome.

It is the same with cooking. You follow step-by-step instructions with intermediate results after each step to achieve the final goal — the incredibly tasty homemade cake.

In a cake recipe, the author wants that everyone can follow the instructions. That is the idea of it, otherwise, people just will not use this recipe and choose another one. When I write test steps in a test case, I follow the same concept. I want everyone in my team to be able to reproduce them without extra questions.

I want to be descriptive and to the point with the steps. It does not matter if we are talking about a test case or a cake recipe. At this step, it is (almost) always better to give a little bit more information, than too little information.

Recipe step example. Pour the cake batter into a prepared baking form and set it to the preheated to 180C oven. Bake 45–50 minutes until the cake is golden brown.

Test step example. Enter a valid username and a valid password and hit the login button. The user is logged in to the system and the user account page is opened.

Conclusion and Final Thoughts

I like writing about test cases. This topic sounds rather obvious and boring, and there is not much content about it. But in practice, it creates lots of confusion, especially for junior, not experienced quality assurance specialists. Bad test cases can be a root cause of bad automation coverage or/and extra work for the team during the sprint.

My goal is to have a common understanding of the structure of test cases within my team. To make the art of writing good test cases easy, understandable, and more fun, I came up with a simple analogy.

If you still struggle with writing good test cases, think about a recipe concept or come up with another analogy, which will work for you. Think of which parts are important for the reader to follow to achieve the expected results. In the end, writing test cases is a piece of cake 😉

--

--

Maria Matyushenko

I am a passionate Software Quality Assurance engineer. My job is to support companies in developing quality thinking and providing high quality software.