Writing a Good Test Case

If you were given a recipe for a cake to follow, and it just gave you a list of ingredients, no amounts or what to put in when, could you successfully make the cake? If you have experience baking you might be able to wing it and end up with something similar, but it wouldn’t be the same as what the recipe described.

So, with a well written recipe for a cake with amounts, instructions, and even sometimes photos (at least if I’m going to follow it, I hate recipes without a photo of what I’m making should end up looking like) you can successfully bake that cake. That important information (the steps to take amounts, etc) are akin to a test case!

I know when I first got into QA and someone was trying to explain how to write a test case I kind of scoffed at them. I could write instructions – how stupid did they think I was? Well, when I wrote my first test case and had a co-worker reaching out with questions as I just assumed they had knowledge about the product that I did, I realized that there is so much more to it, and that maybe I should have been a little less cocky.

In interviews I’ve been asked to write a test case for making a peanut butter and jelly sandwich – pretend you’re explaining it to an alien. I won’t lie, looking back now I feel like I completely bombed it. I mean, I got the job, but there was so much I didn’t know that needed to be included in those instructions.

So, how do you write a good test case? It’s more than step by step instructions; you need details, information you can use to verify each step, and sometimes even screenshots. You also need to base your test cases off of Acceptance Criteria. Still seems simple, but let’s go more in depth on that Facebook login test we wrote.

If I was not writing a simple login test, and trying to just do the very basics my testing would have looked different, and there are more things I would test and account for; even for a simple login page. Some of these may not make sense to you, and that’s fine! We’ll cover them later, don’t worry.

  • Verifying the API calls – is the password encrypted? Are you going to the right endpoint?
  • Verify you are eventually locked out or blocked – you should be after excessive failed attempts
  • Verify you can logout and log back in (verifying that logging out works)
  • Verify password reset works, and only sends an email if you’re using the correct email address
  • Verify the image and name on the login page you are redirected to if your login fails shows the correct name and image if you’re using a valid email address (and you know the profile photo and name of the user)
  • UI verification, for how the page looks, footers, etc
  • Verifying creating a new account on the login page as well, doing negative and positive testing, as well as boundary testing, and trying to create a new account using credentials for an active Facebook account
  • If Facebook was something you were testing internally, with access to their Database (which you won’t have) I would also query the database to check that the email address matched up to the profile name, or user, that I was logging in as

Leave a reply:

Your email address will not be published.

Site Footer