Building Decision Tables

By 26th April 2012 Requirements

Decision Tables are an excellent tool in for both testing and requirements. It is a structured way to formulate requirements and test cases when dealing with complex business rules. Using a decision table will make it easier to write requirements that cover all alternative conditions in business rules. When writing test cases the table will help you to test all combinations.

Method

A Decision Table is usually divided into four quadrants as in the table below.

 

 

The upper half of the table lists the conditions being tested while the lower half lists the possible actions to be taken.

Each column represents a certain type of condition or rule.

 

A few guidelines for constructing a decision table:

To construct a Decision Table follow these steps:

1) Draw boxes for the top and bottom left quadrants.

2) List the conditions in the top left quadrant.

When possible, phrase the conditions as questions that can be answered with a Y for yes and an N for a no.

This type of Decision Table is known as a limited entry table. When a Decision Table requires more than two values for a condition, it is known as an extended entry table.

3) List the possible actions in the bottom left quadrant.

4) Count the possible values for each condition and multiply these together to determine how many unique combinations of conditions are present.

Draw one column in the top and bottom right quadrants for each combination. For example, if there are two conditions and the first condition has two possible values while the second has three possible values, draw six (2 * 3) columns.

5) Enter all possible combinations of values in the columns in the top right quadrant of the table.

6) For each column, that is, each unique combination of conditions, mark an X in the bottom right quadrant in the appropriate action row. The X marks the intersection between the required action and each unique combination of condition values.

How to ensure that the Table is Complete

To complete Step 5 above, ensuring that no combinations are missed, follow these steps:

1) Start with the last condition and alternate its possible values across the row. Note how often the pattern repeats itself. For a condition with two possible values, the pattern will repeat itself every two columns. If three values are possible, the pattern repeats itself every three columns.

For example, for a table with three conditions each with values Y or N, there are eight (2 * 2 * 2) columns. Complete the third (last) row by entering Y once across the row followed by one N. The pattern repeats itself every two columns. The third row would look like: Y N Y N Y N Y N

2) Move to the condition in the row above the last condition. Cover each pattern group with a value for this condition. Note how often the new pattern repeats itself.

For example, complete the second row by entering Y across the row two times followed by two entries of N. This pattern repeats itself every four columns. The second row would look like: Y Y N N Y Y N N

3) Repeat step 2 until all rows are complete. To complete the first row, enter Y across the row four times followed by four entries of N. The first row would look like: Y Y Y Y N N N N

How to Flag Error Conditions

If a specific combination of conditions is invalid, then define one action to flag the error or invalid condition.

 

How to Simplify the Decision Table

If two or more combinations result in the same action, then the table can be simplified. Consider the following example:

Condition 1 Y Y
Condition 2 Y Y
Condition 3 Y N
Action 1 X X

The same action occurs whether condition 3 is true or false. As a result, one column can be eliminated from the table as follows:

Condition 1 Y
Condition 2 Y
Condition 3 −
Action 1 X

A Practical Example of a Decision Table

Company X sells merchandise to wholesale and retail outlets. Wholesale customers receive a two percent discount on all orders. The company also encourages both wholesale and retail customers to pay cash on delivery by offering a two percent discount for this method of payment. Another two percent discount is given on orders of 50 or more units. Each column represents a certain type of order.

 

The Decision Table records the conditions for discounts in the top left quadrant along with the ranges for the conditions in the top right quadrant. The bottom half of the table lists the actions taken, i.e., the discount rates that apply, based on the conditions. Each column represents a certain type of order. For example, column two represents cash on delivery orders of less than 50 units from retailers.

 

References:

Curtis, Graham Business Information Systems: Analysis, Design and Practice. Wokingham: Addison-Wesley.

Martin, James, and McClure, Carma Diagramming Techniques for Analysts and Programmers. Englewood Cliffs: Prentice Hall.

Join the discussion 3 Comments

  • Robai says:

    A million thanks for this simple and straight to the point illustration. I was completely stuck, I’m adequately prepared for my class tomorrow morning. That was God send and I wish you all the best as you continue with this pleasant work.

  • Glory Katende says:

    The article says that extended decision table has more than two values per condition (I guess no only yes and no), what happens when the set of values for a certain condition is unlimited ? How can we draw such tables ?
    Thanks

  • Nice post. I learn something totally new and challenging on blogs I stumbleupon every day.
    It will always be helpful to read articles from other authors and practice a little
    something from their sites.

Leave a Reply