# How to find the number of test cases needed when given a set of conditions?

I'm taking the ISTQB Foundation Level Certification Exam this Friday and while going over the sample exam on the ASTQB website I stumbled upon this question:

"You have been given the following conditions and results from those condition combinations. You can only have one form of payment. A PIN is only needed for a debit card. Given this information, using the decision table technique, what is the minimum number of test cases you would need to test these conditions?"

Conditions:

``````Valid cash
Valid credit card
Valid debit card
Valid PIN
Bank accepts
Valid Selection
Item in Stock
``````

Results:

``````Reject Cash
Reject Card
Error Message
Return Cash
Refund Card
Sell Item
``````

``````a. 7
b. 13
c. 15
d. 18
``````

The answer is C. 15, but their explanation is simply a large decision table with all the combinations. This is great and all, but I don't have time to create a big, relatively complicated decision table with all 15 combinations/columns--I will only have 60 minutes to complete the 40 question test.

Is there an easier/simpler way to find how many combinations/columns/test cases would be needed to test these conditions?

Thanks!

I don't know on which ISTQB site you found the example but I found a PDF with examples here (see #24). In contrast to the exercise you posted, the example above mention the usage of a method called decision table technique.

You should solve it using decision tables because,

1. you are in the context of ISTQB and should prepare yourself for the test and (more important) for your professional life.
2. unlike the way of doing it as suggested by Tam Minh, you have a more formal way of "solving" those problems with the decision table technique.

Particularly, the second point is important when you have to explain yourself on what your resulting test cases are based on.

If I'm in this case, I will break down it based on the results, maybe the result not map with the answer but at least we have a number.

• Reject Cash: invalid cash - 1 case
• Reject Card: invalid card, Bank doesn't accept x2(credit/debit card) and invalid PIN for debit card
• Return Cash: no item in stock - 1 case
• Refund Card: no item in stock - 1 case x2 (credit/debit card)
• Sell Item: all valid conditions - 1 case x3 (cash, credit/debit card)
• Error Message: invalid selection - 1 case x3 (cash, credit/debit card)

Total cases: 15

Hope it helps :)

• You counted the invalid PIN condition twice (one for credit card and one for debit card) but a PIN is only needed for debit card as stated in the question. May 26, 2016 at 16:29
• I updated test cases based on your comment. Thanks :) May 27, 2016 at 2:29

There is no alternative to hard work and knowledge gained. There is no shortcut way to derive the number of test cases without decision table or matrix created else you will make mistake or if you know the answer will try to reverse engineer and convince yourself with it with no real understanding and this wont help in your work life.

Best way is to practise and reduce time taken to derive the total number. I went through this and I am sure you will excel it as well.

All the best for your exam!

According to your solution, it looks like 13( 1+3+1+2+3+3) after adding the number. My opinion is,

Reject Cash: invalid cash - 1 case

Reject Card: invalid card, Bank doesn't accept x2(credit/debit card) and invalid PIN for debit card x1

Return Cash: for cash - 1 case

Refund Card: for card - 1 case x2 (credit/debit card)

Sell Item: Item in Stock - 1 case (Item in stock)

Error Message: any condition - 1 case x7