Test Cases Interview Questions: Write Test Cases Based on Scenario

At STH, we love questions and always encourage them. It is the only way to promote a healthy discussion and develop a perspective.

In today’s article, we will answer two of the interesting questions that were submitted to us through the comments on our articles.

We could have answered them in the comments itself, but due to their length and their wide applicability to everyone in similar situations, we have designed this post just as an exclusive Q&A. 

Let’s start!

Test cases for a given scenario

Also read => 101+ Manual and Automation Software Testing Interview Questions and Answers

Question #1)

This comes to us from “Bhawana Kumara” in response to this post: 7 Types of Software Errors That Every Tester Should Know

“At one of the interview I got this question, Write as many test cases as you can for this scenario – If you are a new customer and you want to open a credit card account then there are three conditions first you will get a 15% discount on all your purchases today, second if you are an existing customer and you hold a loyalty card, you get a 10% discount and third if you have a coupon, you can get 20% off today (but it can’t be used with the ‘new customer’ discount). Discount amounts are added, if applicable.

Can somebody please help me with it.”

Sure. Happy to help!

Answer: This question is a classic case of different processing happening for different kinds of input. The input here is the type of customer. The processing is the amount of discount that they can avail. Depending on the type of input if the output differs, a model that can be successfully used to test is “Decision Table Testing”.

Let’s see how you can do this.

Step 1: Partition your input into categories

To create a decision table, you will have to partition your input into categories.

There are 6 categories of users in this situation:

  • New customers with coupon
  • New customers without a coupon
  • Existing customers with a loyalty card and no coupon
  • Existing customers without a loyalty card and no coupon
  • Existing customers with a loyalty card and Coupon
  • Existing customers without loyalty and with a coupon

More partitions can be made but from the problem definition itself, it is not clear if the new customers can have a loyalty card or not. So let’s not assume it. Besides, this is just to show you how to arrive at a solution.

Step 2: Construct your decision table.

There are many ways to do this. I would use all the input categories as columns and discounts as rows. You end up with the following table:

(Click on the below image for enlarged view)

decision table

Step 3: Pick a user from each input category and test

Now from each category, you can pick one value and test to see if the correct amount of discount is applied.
So now, you will need at least 6 customers or 6 test cases to test the case completely.

I’m sure at this point you are thinking, “This is all good. But how can I answer the question in an interview instantly when I do not have the time to work out the detailed solution as you did?”

This is why it is important to talk about your thoughts in an interview.

As soon as you hear the question, you can say: I think a decision table will help solve this problem. If the interviewer wants you to elaborate, you can ask for a notepad and a pen and work it out. Be sure to explain your solution as you go.

Also, keep in mind that, it is not important to get the solution a 100% right. So you might miss an input category or two, because of the pressure in an interview or in haste and that is OK. The interviewer will be appreciative of your strategy and clarity of thought.

With that, we hope we could answer this question to your satisfaction! For more information on decision tables, check out: How to Write Complex Business Logic Test Scenarios Using Decision Table Technique

Also read => How to write effective test cases

Question #2)

Dhrumil posted the question: “What is 80:20 rule or Pareto principle? Please explain through Example.” in response to All In One Guide On Defect Density – Its Importance and How to Calculate It.

Answer: 80/20 rule is also called the Pareto principle. You can check out a basic definition here at Pareto principle

It says 80% of the results are due to 20% of the causes. It can be applied to many things and in the context of an IT QA project, the following may be observed.

  • 80% of your productivity is due to 20% of the activities that you do
  • 80% of progress is contributed by 20% of your team
  • 80% of the application can be tested by 20% of the test cases
  • 80% of the malfunctions can be addressed by fixing 20% of your defects

And, so on..

Therefore, following this rule, we will have to identify what that 20% of the causes.

Pareto analysis is simply a technique that helps you optimize your efforts. Instead of distributing your focus and effort on all 100% causes, it tells us to look for that 20% of the causes which when addressed maximize your returns (80% of the problems).

  • This is not an exact science and should not be taken at face value.
  • The Pareto Analysis finds its usage in many industries and not just software.
  • To know exactly what that 20% of the causes are, you could draw up a Pareto chart. It is a simple combination of both bar and line charts that plot the causes on the X axis and problems on the Y axis. The cumulative frequency line point of 80% is dropped onto the X axis. All the causes that lie in between 0 and the line are the 20% causes.

For example: if there are 5 modules in an application that have defects to be fixed and this is the distribution of them:

defect management 1

You will now reorder this table in a descending order of defect count and calculate the cumulative frequency percentage.

defect management 2

When we draw a Pareto Chart for the above tabular data, this is what you will end up with:

(For the exact steps as to how to generate a Pareto Chart in Excel follow this link: Pareto Chart)

cumulative frequency

Now, to know what your 20% of the modules are to fix in order to target optimum defect fixing, draw a line at the 80% mark on your cumulative frequency percentage axis, like below:

cumulative frequency 1

Hence, the 20% modules you should focus on are Module 1, 4 and 2.

This is, of course, a contrived example, but when the number of causes is in a few 10’s this method can do wonders in terms of giving us the clarity on what to pick.


Thank you for your wonderful questions, readership and participation.

Thanks to Swati S., STH team member for answering these questions in more details.

Please do let us know how we did on this article and if it had been helpful. Also, go ahead and submit more questions!

PREV Tutorial | NEXT Tutorial

Recommended Reading

14 thoughts on “Test Cases Interview Questions: Write Test Cases Based on Scenario”

  1. How should one answer this question?
    Qn : What is the most complex thing you have done in your current job?
    (I have not done any complex thing as such as a manual test engineer so please suggest the answers)

  2. Thanks Swati for such a nice article. @shradha

    You can say you are working in X domain. So you created some queries using joins and some other SQL by which you got the data easily by just giving the customer id.
    You could talk about some optimisation did which saved some time.
    May be if you have not done check in your team, people do add value to the system

  3. @ Shraddha: Most complex thing: Qs like this don’t have to have a politically correct answer. Everyone’s idea of ‘complex’ is different. You can say that you have enjoyed challenges and overcome them and nothing was so big that you felt like it was complex or complicated. It shows your positive attitude and also, it is the truth. :) I hope this helps!

  4. @Gaurav Khurana: Thanks once again for your continued readership and taking the time to comment. Not only that, you have answered a user question- we appreciate your participation. :)

  5. Thank You Swathi for an beautiful explanations for the above Qs.

    @Swathi Seela / @Gaurav Khurana

    Can we get more explanation for the Shraddha’s Question (Q: What is the most complex thing you have done in your current or previous jobs?) with any real time situations.

    I too had the same question in my previous interview, but my interviewer not satisfied my answer, I have explained him that I have spent whole weekend (Fri-Sun) on my desk to complete end-to-end testing for the last minute complicated defects/issues raised after the tested software transported into Pre-Prod Environment, & we were ready for UAT. I said that couple my senior developers and myself were sitting for nights and fixed the issues for a successful UAT. But, I realised later that my interviewer is not happy for the answer and didn’t got that job, though I was in front for job.

    Can you please explain me with more examples in real time scenario.

    Thanks in advance

    Kind Regards,
    Krish Reddy

  6. Very good article. I have no idea about 80-20 rule, now clear with explanation provided with the example.
    Thank you Swathi!

  7. Q: What is the most complex thing you have done in your current or previous jobs?) with any real time situations.plz explain it

  8. What is the most complex thing you have done in your current or previous jobs?) with any real time situations.plz explain it

  9. Thank you for this!
    Have we also considered purchases on other days? Because the 15% and 20% discounts are only for ‘today’. What about the test cases for purchases other than ‘today’ ?

  10. sir one interview they asked me to write test cases for..they given 2 inputs one is fuel consumption and second one is vehicle speed .given output from model is fuel economy. pls explain me to write write test cases for this

  11. If there is a form and it has 20 fields on it…what would be the strategy to write test-cases? because with 20 fields there can be infinite number of test-cases. The new entrants encounter this problem.

Leave a Comment