Loading

Decision Table in Software Testing


What is decision table in the field of software testing?

Decision table may be seen as a tool, which may be used in either carrying out the testing or in managing the requirements of a software product. Mainly, it is used to deal with the different combinations of input data along with their corresponding output.

Also known by the name of the cause-effect graph, it's an effective technique to formulate and model complex business rules and logic along with their corresponding actions in a compact form, which may assist developers or testers in their respective process.

Defining different input combinations for implementing complex business logics in a text format may not seem too appealing whereas visualizing it in a tabular form may provide ease to developers or testers to understand the complex requirements, easily and helps in taking decisions regarding, which requirements are logical or illogical and what is important or unimportant to consider and implement.

Why the need of decision table arises?

The primary reason behind using the decision table is to deal with the different combinations of input to model and implement complex business logics & rules. It is used to derive and design test cases for implementation of complex business and functional requirements.

Further, the number of combinations with the available inputs would be much larger, and it will almost be infeasible to consider each and every combination for the testing purpose. Decision table works out the solution for this problem and provide significant, small and precise subsets of input combination to carry out testing in an effective manner.

One more purpose, for using the decision table, may be inferred from the fact that the techniques like boundary value analysis and equivalence partitioning may be applied and used for a specific condition or input data. However, these techniques shows inefficiency in dealing with the different combinations of input resulting in different actions or sequence of events. The deficiency in these two techniques to cope with the complex business requirements or rules is fulfilled by the decision table.

How to design tests using a decision table?

Let's go through, step-by-step procedure, to design a test case using a decision table.

Analyzing the requirements

First step involves the study and analysis of the requirements based on which first column of a decision table is build. Usually, first column consists of condition(s) and their corresponding outcomes.

For an example, consider a railway ticket booking system, where a lady user seeks a seat for booking. On the non-availability of seat, the lady may opt for the ladies quota option.

Now, we have analyze the requirements and come up with the following conditions along with the corresponding action.

Conditions
Seat available
Seat available under Ladies Quota
Action
Book the Ticket

Inserting more columns

Each condition may be either true or false i.e. there will be 2 columns for each condition. There is a general formula for calculating the number of columns in the decision table, which may be seen as under:

No. of column = 2n where n= number of conditions.

In the given example, we have two conditions therefore, number of columns to be added will be 22, i.e. 4 columns.

Conditions
Seat available
Seat available under Ladies Quota
Action
Book the Ticket

Assigning TRUE and FALSE to each condition

Now, we have to make possible combination from these conditions by considering the conditions either in true (yes) or in false(no) state at an instant of time as shown below:

Conditions
Seat available T F T F
Seat available under Ladies Quota T T F F
Action
Book the Ticket

Reducing the table

Next step is to reduce the table size by reducing the unnecessary or illogical columns. Let’s see, how to reduce it.

Conditions
Seat available T F T F
Seat available under Ladies Quota T T F F
Action
Book the Ticket

In the given table, the first column reflects the fact that seat is available along with the availability in Ladies quota also, but since the seat is already available, there arises no need to go for the Ladies option. Now, we can leave the cell blank corresponding to Ladies option in the first column.

Similarly, in the 3rd column, we may leave the cell corresponding to ladies quota option blank as the seat is already available. Therefore, the table will now look like this

Conditions
Seat available T F T F
Seat available under Ladies Quota - T - F
Action
Book the Ticket

Now, we have to get rid of duplicate columns, so by deleting either 1st or 3rd column, the table gets reduced as shown below.

Conditions
Seat available T F F
Seat available under Ladies Quota - T F
Action
Book the Ticket

Plan the Action

Based on the status of each condition, we decide the state of the action i.e. either True or False.

Conditions
Seat available T F F
Seat available under Ladies Quota - T F
Action
Book the Ticket T T F

Creating test cases

Based on the generated decision table, test cases may be created to ensure at least one test case for each column to have the full coverage of the business rules.

In view of the above, it may be stated that a decision table is an effective method, which not only just deals with the complex business logics, but also looks after the management of the complex requirements so as to ensure the full coverage of the requirements using minimal efforts.