QA Interview Hub · Knowledge base · Quizzes · Українська

QA Fundamentals › Test design techniques

What is a decision table and when do you use it?

A decision table lists combinations of conditions with matching actions, so it is used when the result depends on several conditions together. Each column is a rule and a separate test, n binary conditions give 2 to the power of n columns, and coverage is measured in columns. The table is collapsed with a dash only where a condition does not affect the result. It exposes combinations with no defined action.

QA Fundamentals · Test design techniques

A transfer is declined because funds are low and the limit is used up. Which error to show? The requirements say nothing.

The transfer rule sounds simple: the account is active, there are enough funds, the limit is not exceeded, so the transfer goes through. In practice each condition may be met or not, and the system has to react correctly to every combination. Neither classes nor boundaries help here: they work with one field, while the result depends on several conditions together. That is what a decision table is for.

How it works and why

The table has two blocks of rows: conditions (what we check) and actions (what must happen). Each column is one rule: a specific combination of condition values and the matching action. For n binary conditions the full table has 2n columns: 3 conditions give 8, 5 give 32, 10 give 1,024.

The benefit is that the table forces you to list the combinations exhaustively, and gaps in the requirements show at once: either a column has no described action, or two columns contradict each other. In ISTQB, coverage is measured in columns: how many rules are checked by at least one test.

The table is often collapsed. If the result of a rule does not depend on a condition, it is replaced by "—" ("do not care") and several columns merge into one. Below the account is inactive, and then the state of funds and the limit changes nothing.

A decision table for a transfer

#Account activeFunds enoughLimit okResult
1No——Declined: account
2YesNoYesDeclined: funds
3YesYesNoDeclined: limit
4YesNoNo?
5YesYesYesTransfer
Figure 1. Eight combinations are collapsed into five rules (rows here, columns in the classic layout). Rule 4 has no action in the requirements: a question for the analyst.

Example: from the table to test cases

Each column becomes a test with concrete data. For the transfer it may look like this:

  • Rule 5. The account is active, the balance is 5,000, the daily limit is 10,000, the transfer is 1,000: we expect success and a debit.
  • Rule 2. The account is active, the balance is 500, the transfer is 1,000: a "not enough funds" decline, the balance is unchanged.
  • Rule 3. The balance is 50,000, but 9,500 was already transferred today, the transfer is 1,000: a decline by the limit.
  • Rule 1. A blocked account: a decline regardless of the balance and the limit.
  • Rule 4. Both the balance and the limit are insufficient: what does the system show?

Rule 4 is the most valuable result. Without the table it is easy to miss, and in production the user would see either a random one of two errors or a generic "something went wrong". The tester goes to the analyst with a concrete question: which error takes priority, should both be shown.

The full table and the collapsed one

Full: 8 columns

All combinations of three conditions. Nothing is lost, but in four columns the result is the same (the account is inactive).

Collapsed: 5 columns

Where a condition has no effect, "—" stands. Fewer tests, and every rule has its own reason.

Figure 2. Collapsing saves tests only where the independence of a condition is confirmed by the requirements.

Limits and alternatives

  • With 5-6 conditions the table grows. Then it is split into several tables by blocks of rules, or the combinations are chosen by risk or with pairwise.
  • Conditions must be unambiguous (yes / no), not "a reasonable amount". An unclear condition is first broken into checkable ones: a comparison with a threshold, the presence of a flag.
  • Some combinations are impossible (for example, "first transfer" and "transfer history is not empty"). They are marked as unreachable, not silently deleted.
  • When the result depends on the order of events, state transitions are needed instead of a table.

Typical mistakes

  • Checking only the happy column. Every decline is a rule too, with its own action.
  • Collapsing with "—" where the condition does matter. The test for a real difference is lost.
  • Mixing conditions and actions in one row. A condition describes input, an action describes output.
  • Inventing the missing rule. An unknown result is a question to the requirements, not the tester's choice.

Check yourself

There are four binary conditions. How many columns does the full decision table have?

Answer

16, that is 2 to the power of 4. The table can be collapsed by merging rules where a condition does not affect the result, but this must be confirmed by the requirements first.

What does "—" in a condition cell mean and how is it different from "No"?

Answer

"—" means the value of the condition does not matter for this rule: the result is the same for both "Yes" and "No". "No" is a concrete value that affects the result. So replacing "No" with "—" without grounds wrongly removes a test.

The table revealed a combination with no action in the requirements. What do you do?

Answer

I do not invent the expected result. I formulate a question to the analyst or product owner with a concrete data example and add the rule to the table when I get an answer. Without an answer, the test stays an open question in the requirements.

In an interview. Junior: I use a decision table when the result depends on a combination of conditions. I list all combinations and the expected action, and check each column with a separate test. Often this immediately gives a question for the requirements. Middle/Senior: I collapse the table only when the independence of conditions is confirmed, and I mark unreachable combinations (N/A) or remove them with a note, and leave them out of coverage. For large sets of conditions I split the table or choose combinations by risk. I treat coverage as the share of columns checked by tests, and I record rules without a defined action separately.

More articles in this chapter