Learn Decision Table Testing with Example


Decision Table

A Decision Table is a table that shows the relationship between inputs and rules, cases, and test conditions. It's a very useful tool for both complicated software testing and requirements management. The decision table allows testers to examine all conceivable combinations of requirements for testing and to immediately discover any circumstances that were overlooked. True(T) and False(F) values are used to signify the criteria.

What is Decision Table Testing?

Decision table testing is a type of software testing that examines how a system responds to various input combinations. This is a methodical methodology in which the various input combinations and the accompanying system behavior (Output) are tabulated. That's why it's also known as a Cause-Effect table because it captures both causes and effects for improved test coverage.

Let's start with a simple example.

Example 1 − How to Create a Login Screen Decision Base Table

Let's make a login screen with a decision table. A login screen with E-mail and Password Input boxes.

The condition is simple − The user will be routed to the homepage if they give the right username and password. An error warning will appear if any of the inputs are incorrect.

ConditionsRule 1Rule 2Rule 3Rule 4
Username (T/F)FTFT
Password (T/F)FFTT
Output (E/H)EEEH

Legend

  • T - Make sure your login and password are correct.

  • F - Incorrect login or password

  • E - An error message appears.

  • H - The home screen appears.

Interpretation

  • Case 1 − Both the username and password were incorrect. An error message is displayed to the user.

  • Case 2 − The username and password were both right, however, the password was incorrect. An error message is displayed to the user.

  • Case 3 − Although the username was incorrect, the password was accurate. An error message is displayed to the user.

  • Case 4 − The user's username and password were both accurate, and the user went to the homepage.

We may generate two situations when converting this to a test case.

  • Enter the right username and password and click Login; the intended consequence is that the user will be sent to the homepage.

And one from the situation below.

  • If the user types in the erroneous username and password and then clicks Login, the user should receive an error message.

  • When you provide the proper username and incorrect password and click Login, the user should see an error message.

  • If the user types the erroneous username and password and then clicks Login, the user should receive an error message.

Because they are both effectively testing the same rule.

Example 2 − How to Make an Upload Screen Decision Table

Consider a dialog box that prompts the user to submit a photo under particular situations, such as -

  • You can only upload images in the '.jpg' format.

  • a file with a size of fewer than 32 kilobytes

  • 137*177 pixels is the resolution.

If any of the requirements are not satisfied, the system will display an error notice describing the problem, and if all conditions are met, the photo will be correctly updated.

Let's make a choice table for this situation.

Condition sCase 1Case 2Case 3Case 4Case 5Case 6Case 7Case 8
Format.jpg.jpg.jpg.jpgNot.jpgNot.jpgNot.jpgNot.jpg
SizeLess than 32 kbLess than 32 kb>=3 2 kb>=32 kbLess than 32 kbLess than 32 kb>=32 kb>=32 kb
Resolution137* 177Not 137* 177137* 177Not 137*1 77137*1 77Not 137*17 7137*17 7Not 137*177
OutputPhoto UploadedError Message resolution mismatchedError message size mismatchError message size and resolution mismatchedError message for format mismatchError message format and resolution mismatchError message for format and size mismatchError message for format, size, resolutio n mismatch

Based on the given data, we can develop 8 separate test cases to assure comprehensive coverage for this condition.

  • Click on upload to add a photo with the type '.jpg,' a file size of less than 32kb, and a resolution of 137*177 pixels. The expected outcome is that the photo will upload successfully.

  • Click on upload to add a photo with the format '.jpg,' a file size of less than 32kb, and a resolution of less than 137*177 pixels. The anticipated outcome is The resolution mismatch in error messages should be displayed.

  • Click on upload to add a photo with the format '.jpg,' a file size of more than 32kb, and a resolution of 137*177 pixels. The anticipated outcome is The size of the error message should be displayed.

  • Click on upload to add a photo with the type '.jpg,' a file size greater than 32kb, and a resolution of less than 137*177 pixels. The anticipated outcome is A discrepancy in the size and resolution of error messages should be displayed.

  • Click on upload and select a photo with a format other than '.jpg,' a file size of less than 32kb, and a resolution of 137*177 pixels. The anticipated outcome is If there is a format mismatch, an error message should be displayed.

  • Click on upload and select a photo with a format other than '.jpg,' a file size of less than 32kb, and a resolution of less than 137*177 pixels. Error message format and resolution mismatch should be shown as the expected outcome.

  • Click on upload to add a photo in a format other than '.jpg,' a file size greater than 32kb, and a resolution of 137*177 pixels. Error notice for format and size mismatch should be displayed, as expected.

  • Click on upload and select a photo with a format other than '.jpg,' a file size of more than 32kb, and a resolution of less than 137*177 pixels. The anticipated outcome is If there is a format, size, or resolution mismatch, an error message should be displayed.

Importance of Decision Table Testing

Decision table testing is important because it allows you to test multiple combinations of circumstances and ensures that complicated business logic is thoroughly tested. Decision table testing provides high coverage and the representation is simple, making it easy to read and apply for evaluating the behavior of a vast number of inputs where system behavior vary with each set of input.

Boundary value and analogous partition are two more related strategies used in Software Engineering to provide greater coverage. They're utilized when a system's behavior is consistent over a wide number of inputs. However, in a system with varied system behavior for each set of input values, the boundary value and equivalent partitioning techniques are ineffective in guaranteeing appropriate test coverage.

Decision table testing is a useful alternative in this instance. This approach ensures adequate coverage, and the representation is straightforward, making it simple to understand and apply.

Because it is simple to grasp and covers all possible combinations, this table may be used as a reference for requirements and functionality development.

As the number of inputs grows, the relevance of this strategy becomes apparent. 2 n, where n is the number of inputs, equals the number of potential combinations. The number of combinations for n = 10, which is very common in web-based testing with large input forms, is 1024. Obviously, you cannot test all conceivable combinations, but you may pick a large subset of them using the decision-based testing approach.

Decision Table Testing's Benefits

  • When the system behavior varies depending on the input and is not consistent over a range of inputs, neither equivalent partitioning nor boundary value analysis can help, but a decision table can.

  • The representation is basic enough to be simply understood and may be utilized for both development and business.

  • This table will aid in the creation of successful combinations and can improve testing coverage.

  • Any complicated business situation may readily be transformed into a decision table.

  • This strategy can provide coverage when we are aiming for 100 percent coverage, which is usually the case when the number of input choices is modest.

Decision Table Testing's Drawbacks

The biggest drawback is that as the number of inputs grows, the table becomes more complicated.

Decision Table Testing's Scope

When data is complicated and every possible combination must be checked, decision tables can quickly grow to be enormous. You may intelligently minimize the number of options in each option to only select the ones that are intriguing and significant. Collapsed Decision Table Testing is the name for this method.

The redundant criteria that are unrelated to the outcome are eliminated in this procedure, and various outputs are created. In order for the tester to execute more effective testing, an additional layer of analysis is added to the test design.

Decision tables are a dependable specification-based testing tool that may be used in a variety of contexts. The tabular and graphical representations are very easy to grasp for all stakeholders and non-technical people.

Through instructive examples and real-life scenarios, project team members may quickly get thorough insights into the topic at hand.

The usefulness and efficiency of this testing approach may be realized by proceeding to the next level of collapsible decision-making table.

Updated on: 25-Oct-2023

20K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements