, , ,

Decision Tables : An aid in Programming/ Testing
Abhilash Gopi

– Decision Tables have been used in number of areas requiring precise decision making.
– It gives a clear understanding of what needs to be done and verified.
Decision Tables
– Decision Tables offer a simple, visual aid, and they can be applied in knowledge-based systems to perform verification processes efficiently.

Decision Tables in Software Development
– In software development, decision tables help developer/ test teams manage complex logic in software applications.
– This presentation will deal with the know-how on how to plan and conduct test with the help of decision tables.
– Testing complex logic becomes an easy affair when verified by means of decision tables.

Features of Decision Tables
– A formalized approach to conduct elaborate testing
– Encapsulation of logic in the decision table
– A tool centered around decision points
– A testing logic easy to keep track of and to change / modify
– Can be read and filled out by non-programmers too

How to use decision tables?
– When a decision point is reached in the testing process, the tester examines the state of the AUT, and determines a test action
– Each decision points can be specified with a decision table.

Components of Decision Tables
– A decision table has two parts
¨ Condition part
¨ Action part
– The decision table specifies under what conditions a test action must be performed
– Each condition expresses a relationship among variables that must be resolvable as TRUE or FALSE
– All the possible combinations of conditions define a set of alternatives
Components of Decision Tables
– For each alternative, a test action should be considered
– The number of alternatives increases exponentially with the number of conditions and is given by 2# of conditions
– When the decision table becomes too complex, a hierarchy of new decision tables can be constructed.

Four quadrants of Decision Table

– Each condition corresponds to a variable, relation or predicate whose possible values are listed in the condition alternatives
– Each action is a procedure or operation to perform, and the action entries specify whether the action is to be performed for the set of condition alternatives to which the action corresponds to.
– If a particular condition has little influence on the actions, the action entry can be indicated with a hyphen (-). It means a “Don’t care”.

A simple example
Preparing a Decision table
# What is really required?

¨ Condition stubs
– They describe the conditions or factors that will affect the decision. Constitute the top part of the table

¨ Action stubs
– Describe the possible decision/ policy actions. Constitute the lower section of the table.

¨ Rules
– Rules describe which actions are to be taken under a specific combination of conditions. It is done by putting X in the appropriate columns of the action sections of the table.

Decision Table Methodology
– Identify conditions and Values
¨ Find the data attribute of each condition tests and all of the attribute’s values

– Compute maximum # of rules.
¨ Multiple the number of values for each condition data attribute by each other.

– Identify Possible actions
¨ Determine each independent action to be taken for the decision

– Enter all possible rules
¨ Fill in the values of the condition data attributes in each numbered rule column

– Define actions for each rule
¨ For each rule, mark the appropriate actions with “X” in the decision table.

– Verify the policy
¨ Review it with the end-users

– Simplify the table
¨ Eliminate or consolidate rules to reduce number of columns

Example : How to?
– Scenario
¨ A marketing company wishes to construct a decision table to decide how to treat clients according to 3 characteristics (Gender, City and Age)
¨ A (under 30), B (between 30 and 60), C (over 60).
¨ There are 4 products (W, X, Y, Z)
¨ Product W appeals to female city dwellers, Product X to all young females. Product Y to Male middle aged not living in cities and Product Z to all but not older females.

– Identify conditions and values
¨ The 3 data attributes are Gender (M, F), City dweller (Y, N) and Age group (A, B, C)

– Compute maximum number of rules
¨ Max # of rules is 2 x 2 x 3 = 12

– Identify possible actions
¨ The 4 actions are Product W, X, Y, Z

Action section (All possible actions)
Define actions for each Rule

Verify and Simplify
– Verify the policy
¨ Get it reviewed with the end-user
– Simplify the table
¨ Note that rules 2, 4, 6, 7, 10, 12 have the same action pattern.
¨ Rules 2, 6, 10 have 2 of the 3 conditions values (sex & city) identical, hence can be combined into a single column.

¨ Rules 4 and 12 have identical action pattern, but cannot be combined because not all age groups are included. You will notice that age group “B” is missing

Another example for the typical Archive process.
– This example shows the validation that would be effective in order to proceed with the actual archive process.

Benefits to Software Engineering
– Decision tables make it very easy to observe all possible conditions accounted for
– The “Don’t care” action entries easily convey to the programmer/ tester that the corresponding condition is irrelevant
– Enables a programmer to implement all possible conditions by highlighting them in every possible way
– A proven method to solve and test complex problems

About these ads