• Home
  • Testing
  • SAP
  • Web
  • Must Learn!
  • Big Data
  • Live Projects
  • Blog

What is Decision Table Testing?

Decision table testing is a testing technique used to test system behavior for different input combinations. This is a systematic approach where the different input combinations and their corresponding system behavior (Output) are captured in a tabular form. That is why it is also called as a Cause-Effect table where Cause and effects are captured for better test coverage.

A Decision Table is a tabular representation of inputs versus rules/cases/test conditions. Let's learn with an example.

Example 1: Decision Base Table for Login Screen

Let's create a decision table for a login screen.

The condition is simple if the user provides correct username and password the user will be redirected to the homepage. If any of the input is wrong, an error message will be displayed.

Conditions Rule 1 Rule 2 Rule 3 Rule 4
Username (T/F) F T F T
Password (T/F) F F T T
Output (E/H) E E E H

Legend:

  • T – Correct username/password
  • F – Wrong username/password
  • E – Error message is displayed
  • H – Home screen is displayed

Interpretation:

  • Case 1 – Username and password both were wrong. The user is shown an error message.
  • Case 2 – Username was correct, but the password was wrong. The user is shown an error message.
  • Case 3 – Username was wrong, but the password was correct. The user is shown an error message.
  • Case 4 – Username and password both were correct, and the user navigated to homepage

While converting this to test case, we can create 2 scenarios ,

  • Enter correct username and correct password and click on login, and the expected result will be the user should be navigated to homepage

And one from the below scenario

  • Enter wrong username and wrong password and click on login, and the expected result will be the user should get an error message
  • Enter correct username and wrong password and click on login, and the expected result will be the user should get an error message
  • Enter wrong username and correct password and click on login, and the expected result will be the user should get an error message

As they essentially test the same rule.

Example 2: Decision Base Table for Upload Screen

Now consider a dialogue box which will ask the user to upload photo with certain conditions like –

  1. You can upload only '.jpg' format image
  2. file size less than 32kb
  3. resolution 137*177.

If any of the conditions fails the system will throw corresponding error message stating the issue and if all conditions are met photo will be updated successfully

Let's create the decision table for this case.

Conditions Case 1 Case 2 Case 3 Case 4 Case 5 Case 6 Case 7 Case 8
Format .jpg .jpg .jpg .jpg Not .jpg Not .jpg Not .jpg Not .jpg
Size Less than 32kb Less than 32kb More than 32kb More than 32kb Less than 32kb Less than 32kb More than 32kb More than 32kb
resolution 137*177 Not 137*177 137*177 Not 137*177 137*177 Not 137*177 137*177 Not 137*177
Output Photo uploaded Error message resolution mismatch Error message size mismatch Error message size and resolution mismatch Error message for format mismatch Error message format and resolution mismatch Error message for format and size mismatch Error message for format, size, and resolution mismatch

For this condition, we can create 8 different test cases and ensure complete coverage based on the above table.

  1. Upload a photo with format '.jpg', size less than 32kb and resolution 137*177 and click on upload. Expected result is Photo should upload successfully
  2. Upload a photo with format '.jpg', size less than 32kb and resolution not 137*177 and click on upload. Expected result is Error message resolution mismatch should be displayed
  3. Upload a photo with format '.jpg', size more than 32kb and resolution 137*177 and click on upload. Expected result is Error message size mismatch should be displayed
  4. Upload a photo with format '.jpg', size less than 32kb and resolution not 137*177 and click on upload. Expected result is Error message size and resolution mismatch should be displayed
  5. Upload a photo with format other than '.jpg', size less than 32kb and resolution 137*177 and click on upload. Expected result is Error message for format mismatch should be displayed
  6. Upload a photo with format other than '.jpg', size less than 32kb and resolution not 137*177 and click on upload. Expected result is Error message format and resolution mismatch should be displayed
  7. Upload a photo with format other than '.jpg', size more than 32kb and resolution 137*177 and click on upload. Expected result is Error message for format and size mismatch should be displayed
  8. Upload a photo with format other than '.jpg', size more than 32kb and resolution not 137*177 and click on upload. Expected result is Error message for format, size and resolution mismatch should be displayed

Why is Decision Table Testing is important?

This testing technique becomes important when it is required to test different combination. It also helps in better test coverage for complex business logic.

Boundary value and equivalent partition are other similar techniques used to ensure better coverage. They are used if the system shows the same behavior for a large set of inputs. However, in a system where for each set of input values the system behavior is different, boundary value and equivalent partitioning technique are not effective in ensuring good test coverage.

In this case, decision table testing is a good option. This technique can make sure of good coverage, and the representation is simple so that it is easy to interpret and use.

This table can be used as the reference for the requirement and for the functionality development since it is easy to understand and cover all the combinations.

The significance of this technique becomes immediately clear as the number of inputs increases. Number of possible Combinations is given by 2 ^ n , where n is the number of Inputs. For n = 10, which is very common in the web based testing, having big input forms, the number of combinations will be 1024. Obviously, you cannot test all but you will choose a rich sub-set of the possible combinations using decision based testing technique

Advantages of decision table testing

When the system behavior is different for different input and not same for a range of inputs, both equivalent partitioning, and boundary value analysis won't help, but decision table can be used.

The representation is simple so that it can be easily interpreted and is used for development and business as well.

This table will help to make effective combinations and can ensure a better coverage for testing

Any complex business conditions can be easily turned into decision tables

In a case we are going for 100% coverage typically when the input combinations are low, this technique can ensure the coverage.

Disadvantages of decision table testing

The main disadvantage is that when the number of input increases the table will become more complex

Please be patient. The Video will load in some time. If you still face issue viewing video click here

 

YOU MIGHT LIKE: