# Decision table testing ###### tags: `Black Box Testing Tech` `ISTQB` `Software Testing` `SQA` - **Specifications often contain business rules to define the functions of the system and the conditions under which each function operates.** - **As testers we need to be able to assure ourselves that every combination of these conditions that might occur has been tested**, so we need to capture all the decisions in a way that enables us to explore their combinations. **The mechanism usually used to capture the logical decisions is called a decision table.** ![](https://i.imgur.com/wzLojRs.png) In reality the number of conditions and actions can be quite large, but usually the number of combinations producing specific actions is relatively small. **For this reason we do not enter every possible combination of conditions into our decision table**, but restrict it to those combinations that correspond to business rules – **this is called a limited entry decision table** to distinguish it from a decision table with all combinations of inputs identified. **DECISION TABLE TESTING – EXAMPLE 4.3** A supermarket has a loyalty scheme that is offered to all customers. Loyalty cardholders enjoy the benefits of either additional discounts on all purchases (rule 3) or the acquisition of loyalty points (rule 4), which can be converted into vouchers for the supermarket or to equivalent points in schemes run by partners. Customers without a loyalty card receive an additional discount only if they spend more than £100 on any one visit to the store (rule 2), otherwise only the special offers offered to all customers apply (rule 1). ![](https://i.imgur.com/dHexdto.png) :::danger :question: 若兩個conditions為互斥,那麼還有需要兩個都列出來嗎?如上述with/without loyalty card。 ::: **From the decision table we can determine test cases by setting values for the conditions and determining the expected output**, for example from rule 1 we could input a normal customer with a £50 transaction and check that no discount was applied. The same customer with a £150 transaction (rule 2) should attract a discount. **Thus we can see that each column of the decision table represents a possible test case.** :::info **Exercise 4.4** A mutual insurance company has decided to float its shares on the stock exchange and is offering its members rewards for their past custom at the time of flotation. Anyone with a current policy will benefit provided it is a ‘with-profits’ policy and they have held it since 2001. Those who meet these criteria can opt for either a cash payment or an allocation of shares in the new company; those who have held a qualifying policy for less than the required time will be eligible for a cash payment but not for shares. Here is a decision table reflecting those rules. ![](https://i.imgur.com/TCKfUqQ.png) ::: What expected result would you expect to get for the following test case? Billy Bunter is a current policy holder who has held a ‘with-profits’ policy since 2003. :::success Billy可以拿到現金,但不會拿到股票 ::: :::danger :question: decision table 和 test condition和test cases 之間的關係是什麼? :::