Decision Tables are an excellent tool 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.
What are Decision Tables?
Decision tables are a systematic exercise used to represent complex business rules. Formulating a table makes it easy to see all of the possible combinations of requirements or conditions so that you can ensure no combinations are missed.
They are used to specify what actions should be performed under certain conditions, which are generally expressed as true (T) or false (F). The columns in a decision table represent the combinations of conditions or rules of a business decision, which will result in a certain action depending on the input. This means that each column represents a test case.
Decision tables are excellent tools to use for requirements management or testing as they make it easy to see when certain pathways have been missed. This then helps testers to write better, more detailed test cases. They are also a great way of tracking the outputs of various combinations.
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.
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 60,000+ Subscribers
For latest blogs, industry updates and exclusive tips.
*Your email is safe with us, we also hate spam