Decision table in Software Testing

Decision table in Software Testing


I. What is a Decision table?

A decision table is a concise visual representation for specifying which
output/actions to perform depending on given conditions.

It is used for both software testing and requirement management in business
analysis. It is an effective tool to visually describe logic, easily identify
test cases.

II. How to create a Decision table

Below is the structure of the decision table.

Condition stub: a list of all the conditions that should be considered.

Condition entries: are filled as Y/N (generally) corresponding condition stub.

Action stub: a list of all actions/output

Action entries: an association between a condition and a particular rule,
generally filled as X.

Rules: a unique combination of conditions and actions to be taken under those

To build a decision table, the following steps are necessary.

  1. List all possible conditions

  2. List all possible corresponding actions

  3. Create a rule by combining conditions together, and type “X” for each
    corresponding combination.

  4. Simplify table

III. How to make a decision table for account registration

Let's go to the following example to learn more about decision tables.

The registration function of a website with the following requirements:

Email and password are required information when registering. The conditions
for registration is only if the email has never been registered on this website
before, and the password must be more than 8 characters.

Possible conditions are:

• Email is valid (correct email format, email cannot be empty)

• Email has not been registered

• Password length must be 8 characters or more

Possible actions are:

• Be able to register, navigate to homepage

• Unable to register, an error message will be shown

Normally, the number of rules is 2 ^ (number of conditions)

In the above case, we can list 8 rules (2^3 = 8 with the number of conditions
being 3)

After listing conditions, and actions, and typing X into the action, we get the
table bellow.

Finally, we can simplify the decision table above by combining “rules” with the
same “Output/Action”.

Checking the created decision table above again, we see that rules 3 and 4 can
be combined into 1 rule because "Password has 8 characters or more" or not does
not affect the result. If “Email is valid” and “Email has not been registered”,
the output will be “Unable to register, an error message will be shown”.

Similarly, we can combine rules 5,6,7,8 into 1 rule.

After shortening the decision table, we get the results as shown in the table

IV. Summary

Decision tables are used to test the relationship between input conditions and
actions/outputs effectively without missing cases.

The decision table can be used as a document so that team members can better
understand requirements in business analysis, and testers can list test cases
more effectively when performing testing.

However, the decision table becomes cumbersome if the business becomes more complex with more conditions. At this point, it can be divided into many smaller, simpler tables to make it easier to understand the business logic and run
test case for testing.

Reference documents: