Arunkumar Khannur's Software Testing Knowledge Center

9.3 Decision Tables in Functional Testing

Decision table based test case design is very effective in addressing functional testing in requirements-based testing. In this technique, number of test cases reduce drastically. In order to write these test cases, we need unambiguous and complete functional description along with conditions in the form of decision table. If functional specification in the form of decision tables does not exist for a given requirements specification, then we need to develop the decision table.

Now we discuss on developing decision table and also, designing test cases. In functional testing, we use decision tables as intermediate step before writing test cases to test functionality of the system under test. Here using decision tables, we represent all possible conditions. When we execute possible conditions we expect a specific action to be taken by the system. In case of a failure to exhibit expected action, it is quite indicative that a logic is missing. Thus, using Decision Tables we can easily track a set of conditions and corresponding actions.

In Decision Table based Testing, steps we follow include:
  • Develop Decision Table
  • Design Test Cases

In the following sections, we illustrate the use of these steps in functional testing with an example.

9.3.1 Developing Decision Tables

In order to build decision tables, first we need to determine the maximum size of the table, then we have to eliminate any impossible situations, inconsistencies, or redundancies, and finally we need to simplify the table as much as possible. Following are tips to develop decision tables, which when followed give a decision table.

  1. Study the given Specification and determine the number of conditions that may affect the decision. Remove any conditions that repeat. Once we arrive at this list of non-repeatable conditions (that is conditions that are mutually exclusive), we have to record all these conditions as rows in the top left half of the decision.
  2. Determine the number of possible actions that can be taken. These become the number of rows in the lower left half of the decision table.
  3. Determine the number of condition alternatives for each condition. In the simplest form of decision table, there would be two alternatives (Y or N) for each condition. In an extended-entry table, there may be many alternatives for each condition.
  4. Then we have to calculate the maximum number of columns in the decision table by calculating number of conditions raise to the number of alternatives. If there were three conditions and two alternatives (Y or N) for each of the conditions, there would be eight alternatives. This is because, the condition rules are yes or no, therefore the number of possible condition rules are 2 alternatives for condition 1 x 2 alternatives for condition 2 x 2 alternatives for condition 3 or 23 = 8.
  5. Fill in the condition alternatives. Start with the first condition and divide the number of columns by the number of alternatives for that condition. In the foregoing example, there are three columns and two alternatives (Y and N), so eight divided by two is four. Then choose one of the alternatives and write Y in all of the four columns. Finish by writing N in the remaining four columns as follows:

    Condition1: YYYYNNNN
    Repeat this for each condition using a subset of the table:

  6. Complete the table by inserting a √ where rules suggest certain actions.
  7. Combine rules where it is apparent that an alternative does not make a difference in the outcome; for example:

  8. Check the table for any impossible situations, contradictions, redundancies.
  9. Rearrange the conditions and actions (or even rules) to make the decision table more understandable.

An Example on Developing a Decision Table
Write test cases for fixed deposit interest calculations with following conditions.

  1. The branch cannot accept more than 5,00,000 deposit in single name.
  2. The minimum balance is Rs 1000/-

Illustrating Developing a Decision Table

In the first step, we have to convert three dimensional problem (since three variables are involved) into two dimensional problem so that we can represent it in Decision Table form. In the given problem, the conditions involve, three variable, viz., Deposit Amount, Duration, Rate of Interest and thus they represent a three dimensional problem. We develop a decision table for the three variables as follows.

In order to develop decision table, we analyze the problem and understand that: Deposit Amount is having 4 combinations; Duration is having 5 combinations; and Rate of Interest is having 5 combinations. Thus we take each Deposit Amount and develop Decision Table as follows:

First we take, for Deposit Amount between 1000 to <=5000. Here the conditions are as follows:

  • Duration of Deposit is 0 to <=90 days
  • Duration of Deposit is 90 days to <=1 year
  • Duration of Deposit is 1 year to <=5 years
  • Duration of Deposit is Above 5 years
The possible actions that could be taken are agreed as:
  • Calculate Interest at 5%
  • Calculate Interest at 5.5%
  • Calculate Interest at 6%
  • Calculate Interest at 7%

Using the rules above, construct a decision table that shows all possible combinations of alternatives.

The condition rules are yes or no, therefore the number of possible condition rules are 2 alternatives for condition 1 x 2 alternatives for condition 2 x 2 alternatives for condition 3 x 2 alternatives for condition 4 or 24 = 16
Khannur's Book
Arunkumar Khannur, Software Testing - Techniques and Applications, Published by Pearson Publications, 2011 (ISBN:978-81-317-5836-6; Pages:341 + xxii)
Follow Khannur
Khannur's Company
ISQT Process & Consulting Services Pvt. Ltd., Bangalore, INDIA
Khannur's Software Testing Forum
 Contact Khannur
ISQT Process & Consulting Services Pvt. Ltd.
#732, 1st Floor, 12th Main,
3rd Block, Rajajinagar,
Bangalore - 560010, INDIA
Phone: +91 80 23012511
Skype: arun.isqt