# 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!

What You Will Learn:

### 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.

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)

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:

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

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)

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:

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.

### Conclusion

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

PREV Tutorial | NEXT Tutorial

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

1. Great….Thanks for sharing this.

2. Thanks for explaining in details… Vijay Sir, You are doing a great job

3. 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)

4. 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

5. @ 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!

6. @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. :)

7. 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.

Kind Regards,
Krish Reddy

• Hi,

Can you please let me know how to write test scenario for to ensure that the stock transactions involved in production processes are consistent: consumed materials should disappear from stock, and created products should appear on stock.
Terminology:
– Item: a physical product that is stored in the warehouse
– Stock quantity: the total quantity of a given item available in the warehouse
– Stock transaction: a transaction that modifies the stock quantity of some items. For example: material consumption, production, receipt, delivery…
– Lot number: an identification number assigned to a particular quantity of an item, for quality control purposes. For example, an orange juice manufacturing company will typically assign a different lot number every day or every shift.
– Serial number: a unique number assigned to each piece of an item. For example, each smartphone has a unique serial number.

Each material and product can have a large variety of possible configurations, which highly affect how the production processes have to be tested. For example, for each materials and product, the following parameters are possible:
– Stock quantity management method (Lot / serial / none)
– Lot number / serial number assignment (automatic / manual)
– Has expiry date (yes / no)
– Material consumption method (automatic / manual)

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

9. Good examples & good clarification, Thanks

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

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

12. 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’ ?

13. 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

14. 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.

15. You’ve run your test cases and it looks like there is a major bug. Select a test case where the
expected result does not meet the actual result, and file a bug report for this case.
this is the situation..can anybody help me to select test case?

• Did you get any help? Can you help me?

16. Question #1)

In the decision table, 2nd test case is wrong.

How? Existing customer coupon discount 20% is not applicable to New customer. that is mentioned in the brackets

“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.

• that’s true.. I was about to write the same. I can see first 2 users with a new account with/without coupons is useless. New customers only get 15% of the first condition and the other 2 conditions are for an existing customer. based on this, there will be only 5 category users, isn’t it???
New customer
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

17. Is “the credit card “question for a fresher to the role?
Please, put few test scenarios for the people who are just starting the role

18. Hi. Can you share a tutorial on how to do test cases for date? It’s a bit confusing on how to do it using Equivalence Partition/BVA, since has leap year & February.

19. 1. You need to write as many test cases as possible for a simple software program which computes the eligible discount for a customer. Try to describe all possible scenarios in a tabular format. Do not worry about ‘login’ kind of test cases, and just focus on how you will validate discount calculation. These are the rules.
If the customer is new, and they are willing to sign up for a new loyalty card, they get a 15% discount on all their purchases on the day. Second if they are an existing customer and hold a loyalty card, they get a 10% discount. Third, if they have a discount coupon, they will get 20% off which cannot be used with the new customer discount but can be used with loyalty card discount. Discount amounts are added, if applicable.

2. The following appeared as part of an article in the business section of a local newspaper:
“Ronnie’s Auto Repair Shop commenced business four months ago at the location formerly occupied by the Jenny’s Beauty Parlour. Ronnie’s Auto must be doing well at this location, because it intends to open a big shop in an adjacent town. Jenny’s, on the other hand, has seen a lower volume of business in its first year at its new location compared to the prior year at its former location. Jenny’s definitely erred in shifting to its new location; its former location is a better site.”
Discuss how well reasoned you find this argument. In your discussion be sure to analyse the line of reasoning and the use of evidence in the argument. For example, you may need to consider what questionable assumptions underlie the thinking and what alternative explanations or counterexamples might weaken the conclusion. You can also discuss what sort of evidence would strengthen or refute the argument, what changes in the argument would make it more logically sound, and what, if anything, would help you better evaluate its conclusion.

Help me to wite test case please

20. I everyone i sit with this scenario in an assignment:
Sanchez is a learner who said to be shown emotional warning signs that need intervention. He was referred to you for counselling by his register teacher. Your task is to work very closely with him to rescue the situation. To assist him, you need to answer the following questions.
the questions that comes with it is the following:

Explain the possible factors that are likely to impact his school work.
Outline the effect of the problems on Sanchez’s school work.