1. Home
  2. Blog
  3. Software Testing

Software Testing

Decision Table Testing: Technique, Examples and Template

Decision table testing turns tangled business rules into a small grid you can turn straight into test cases. Learn the method, a worked example and a template.

8 min read
Decision table testing: technique, examples and template for testers

Key takeaways

  • Decision table testing lists conditions and actions in a grid; each column (a rule) becomes one test case.
  • With n yes/no conditions a full table has 2^n rules, so merge rules whose outcome does not depend on a condition.
  • It fits business rules such as discounts, loans, permissions and shipping fees, not simple single-input checks.
  • Pair it with boundary value analysis and automate the finished table with a parameterised test.

Decision table testing is a black-box test design technique for rules that depend on a combination of conditions. You write every condition and every action in a table, and each column of the table becomes a test.

Think about a checkout page. Shipping might be free depending on the order total, the discount depends on membership, and a coupon only works above a minimum spend. Test these one at a time and you will miss the combinations where rules collide.

This guide explains decision table testing step by step, shows a full worked example with eight rules, collapses it to six, and ends with a reusable template and a short automation sample.

What is decision table testing?

A decision table has four parts: conditions (the inputs), actions (the expected results), rules (each column, one combination of condition values) and the cells that record which condition value each rule uses. The ISTQB glossary defines it as a technique where test cases are designed to execute the combinations of inputs shown in a decision table. Some books call the same idea a cause-effect table.

Part Meaning Example
Condition An input that can be true or false Customer is a member
Action An expected outcome Apply 10% discount
Rule One column: a set of condition values and its actions Member, order over $50, no coupon
Test case One test per rule Check the cart total for that user

When to use decision table testing

  • Several conditions together decide the result.
  • The requirement is written as “if … and … then …” sentences.
  • You need proof that every combination was either tested or deliberately skipped.

It is a poor fit when behaviour depends on a single numeric range (use boundary value analysis) or on a sequence of events (use state transition testing).

How to create a decision table in 5 steps

  1. List the conditions. Pull them from the requirement, one yes/no question each.
  2. List the actions. Write what the system should do or show.
  3. Fill in all combinations. With n conditions you get 2^n columns. Three conditions give 8 rules, four give 16.
  4. Mark the actions for each rule using the requirement, not the code.
  5. Collapse the table. If two rules differ in one condition and have the same actions, merge them and mark that condition with a dash (don’t care).

Decision table testing example: online checkout

Requirement for a small shop:

  • Orders of $50 or more ship free.
  • Members get 10% off.
  • A coupon gives an extra 5% off, but only on orders of $50 or more.

Conditions: M = member, O = order is $50 or more, C = coupon entered. Y means yes, N means no.

Rule M O C Free shipping Discount
R1 Y Y Y Yes 15%
R2 Y Y N Yes 10%
R3 Y N Y No 10%
R4 Y N N No 10%
R5 N Y Y Yes 5%
R6 N Y N Yes 0%
R7 N N Y No 0%
R8 N N N No 0%

Look at R3 and R4. A member with a small order gets no shipping benefit and 10% either way, so the coupon does not matter. The same is true for R7 and R8. Merge them and the table shrinks from eight rules to six:

Rule M O C Free shipping Discount
R1 Y Y Y Yes 15%
R2 Y Y N Yes 10%
R3-4 Y N – No 10%
R5 N Y Y Yes 5%
R6 N Y N Yes 0%
R7-8 N N – No 0%

That gives six test cases that cover every distinct outcome. One caution: the “-” rows hide a real risk. If a developer accidentally lets a coupon work on small orders, only a test with a coupon on a small order will catch it. Many teams keep one such test for rules where “don’t care” is the interesting part.

Tip: turn the table into test data first. Each rule needs a concrete order, for example a $49.99 and a $50.00 cart, which also covers the boundary at $50. See our guide to writing test cases for the format.

Automating the table with pytest

A decision table maps neatly onto a parameterised test. One row of data per rule means the table lives in the code, and a new rule is one new line. The pytest docs describe parametrize in detail.

import pytest

def checkout(member, total, coupon):
    free_shipping = total >= 50
    discount = 10 if member else 0
    if coupon and total >= 50:
        discount += 5
    return free_shipping, discount

@pytest.mark.parametrize("member,total,coupon,free,discount", [
    (True,  60.00, True,  True,  15),   # R1
    (True,  60.00, False, True,  10),   # R2
    (True,  49.99, True,  False, 10),   # R3-4
    (False, 60.00, True,  True,  5),    # R5
    (False, 60.00, False, True,  0),    # R6
    (False, 49.99, True,  False, 0),    # R7-8
])
def test_checkout_rules(member, total, coupon, free, discount):
    assert checkout(member, total, coupon) == (free, discount)

If your suite is in Playwright or Selenium, keep the same idea: a data array drives one test body. Our end to end testing best practices post explains why data-driven tests stay easier to maintain.

Decision table template you can copy

Item R1 R2 R3 R4
Condition 1 Y Y N N
Condition 2 Y N Y N
Action 1 X
Action 2 X X
Test case ID TC-01 TC-02 TC-03 TC-04

Add one row per condition and action, and one column per rule. Link each column to a test case ID so traceability is obvious in a review.

Common mistakes and limits

  • Too many conditions. Ten conditions mean 1,024 rules. Split the requirement into smaller tables.
  • Merging rules too early. Check the requirement, not the code, before using a dash.
  • Missing rules. Count the columns: they must equal 2^n before collapsing.
  • Conflicting rules. If two columns have the same conditions and different actions, the requirement is ambiguous. Raise it with the product owner.
  • Using it for everything. Combine it with boundary value analysis, equivalence partitioning and exploratory testing.

Final thoughts

Decision table testing gives you a clear view of which rule combinations you covered and which you skipped on purpose. Start with the conditions in your next feature spec, build the full grid, merge what truly does not matter and drive the result from a parameterised test. Even a small table often exposes a missing requirement before a single line is tested.

Frequently asked questions

What is decision table testing in simple words?

It is a way to list all combinations of conditions and the expected result for each one in a table, then write one test per column.

How many test cases does a decision table give?

A full table has 2^n rules for n yes/no conditions. After merging rules with the same outcome you usually test fewer.

Is decision table testing black box or white box?

It is a black-box technique, because rules come from the requirements, not from the code.

What is the difference between decision table and state transition testing?

Decision tables test combinations of inputs at one moment. State transition testing checks how behaviour changes across a sequence of events.

Can decision table testing be automated?

Yes. Put each rule in a data row and run one parameterised test, for example with pytest parametrize, JUnit or a Playwright data array.

Keep learning

Work with Stack Quora

Need help with testing, WordPress or SEO?

We help teams ship better software and grow their sites. Tell us what you are working on and we will suggest a clear next step.

Keep reading

More guides on testing, AI & modern development

Enjoyed this article? Pick a topic and jump straight into our newest tutorials.

Artificial Intelligence

LLM Structured Output Explained: Getting Reliable JSON From AI Models

LLM structured output explained with validation we ran in Pydantic: JSON mode and schemas, constrained decoding, the ways model output…

Read article →
DevOps

SSH Keys Explained: How They Work, ssh-keygen, Ed25519 and Safe Habits

SSH keys explained with keys we generated: public vs private keys, ssh-keygen, Ed25519 vs RSA, fingerprints, passphrases, ssh-agent, authorized_keys, config…

Read article →
DevOps

HTTP Caching Explained: Cache-Control, ETag and 304 Responses, With a Live Test

HTTP caching explained with a small server we ran: Cache-Control directives, max-age, no-cache vs no-store, ETag revalidation and 304 responses,…

Read article →
Test Automation

API Contract Testing Explained: Catch Breaking Changes Before They Ship

API contract testing explained with a schema check we ran: what a contract is, consumer-driven contracts, Pact, OpenAPI, which changes…

Read article →
Software Testing

Risk-Based Testing Explained: Score Risks, Build a Matrix and Test What Matters

Risk-based testing explained step by step: identifying risks, scoring likelihood and impact, building a risk matrix, mapping risk to test…

Read article →
Databases & SQL

SQL Constraints Explained: NOT NULL, UNIQUE, CHECK and FOREIGN KEY, Tested

SQL constraints explained with tests we ran: NOT NULL, UNIQUE, CHECK, DEFAULT, PRIMARY and FOREIGN KEY, the NULL loopholes, SQLite's…

Read article →
Databases & SQL

SQL Date Functions Explained: Adding, Comparing and Grouping Dates Without Bugs

SQL date functions explained with queries we ran: adding intervals, month-end surprises, date differences, the BETWEEN trap, grouping by day,…

Read article →
Software Development

Python asyncio Explained: async, await, gather and TaskGroup With Real Timings

Python asyncio explained with code we timed: coroutines, await, gather, TaskGroup, error handling, timeouts, limiting concurrency and the blocking-call mistake…

Read article →
Software Development

Debounce vs Throttle in JavaScript: How They Work, When to Use Each, Tested

Debounce vs throttle in JavaScript explained with timings we measured in Node.js: how each works, simple implementations, leading and trailing…

Read article →
Software Development

Python Context Managers Explained: The with Statement, contextlib and Real Uses

Python context managers explained with code we ran: how with works, __enter__ and __exit__, contextlib.contextmanager, suppress, ExitStack, database transactions and…

Read article →
Artificial Intelligence

LLM Temperature and Top-p Explained: How AI Models Choose Their Next Word

LLM temperature and top-p explained with a simulation we ran: how probabilities are reshaped, what top-p keeps, recommended settings by…

Read article →
DevOps

YAML Explained: Syntax, the Norway Problem and Other Traps We Tested

YAML explained with a parser test: basic syntax, lists and maps, the Norway problem, versions turning into floats, octal zip…

Read article →
DevOps

Cron Jobs Explained: Syntax, Real Schedules and the Mistakes That Break Them

Cron jobs explained with schedules we verified: the five fields, operators, real examples, the day-of-month OR day-of-week trap, environment problems,…

Read article →
Software Testing

Bug Life Cycle in Software Testing: Every Status, Who Owns It and Common Mistakes

The bug life cycle explained: every defect status from New to Closed, who owns each step, rejected, deferred and reopened…

Read article →
Test Automation

Property-Based Testing in Python: Hypothesis Finds the Bugs Your Examples Miss

Property-based testing explained with Hypothesis tests we ran: properties vs examples, strategies, shrinking, the real bugs it found in our…

Read article →
Databases & SQL

SQL Pagination Explained: OFFSET vs Keyset, With a Million-Row Test

SQL pagination explained with a million-row test we ran: LIMIT and OFFSET, why deep pages get slow, keyset (cursor) pagination,…

Read article →
Databases & SQL

SQL EXISTS vs IN: Differences, the NOT IN NULL Trap and Performance

SQL EXISTS vs IN explained with queries we ran: how each works, why NOT IN returns no rows when a…

Read article →
Software Development

Python Logging Explained: Levels, Handlers, Formatters and Mistakes to Avoid

Python logging explained with code we ran: levels, basicConfig quirks, named loggers, handlers and formatters, logger.exception, lazy formatting, duplicate logs…

Read article →
Software Development

JavaScript Map vs Object: Key Differences, Pitfalls and a Benchmark

JavaScript Map vs Object explained with code we ran in Node.js: key types, ordering, the prototype trap, JSON, size, WeakMap…

Read article →
Software Development

Python Type Hints Explained: Annotations, mypy and the Errors It Catches

Python type hints explained with a real mypy run: basic annotations, Optional and unions, TypedDict, Literal, Protocol, generics, Callable, strict…

Read article →
Artificial Intelligence

LLM Tokens Explained: How AI Models Read Text, Count Costs and Fill Context Windows

LLM tokens explained with a tokenizer we ran: how text is split, why counts differ by language and tokenizer, context…

Read article →
DevOps

Semantic Versioning Explained: MAJOR.MINOR.PATCH, Ranges and Release Rules

Semantic versioning explained with code we ran: MAJOR.MINOR.PATCH rules, pre-releases, correct version sorting, caret and tilde ranges, 0.x versions, lockfiles…

Read article →
DevOps

Git Reset vs Revert: How to Undo Commits Safely, With a Tested Example

Git reset vs revert explained with a repository we built: soft, mixed and hard reset, revert commits, reverting merges, recovering…

Read article →
Software Testing

The Test Pyramid Explained: Layers, Ratios and When to Break the Shape

The test pyramid explained: unit, integration and end-to-end layers, sensible ratios, the ice cream cone anti-pattern, the testing trophy and…

Read article →
Test Automation

pytest Fixtures Explained: Scope, yield Teardown, conftest.py and Factories

pytest fixtures explained with a suite we ran: how fixtures work, scopes, yield teardown, conftest.py, factory fixtures, parametrized fixtures, built-ins…

Read article →
Databases & SQL

SQL Upsert Explained: INSERT ON CONFLICT, MERGE and the REPLACE Trap

SQL upsert explained with queries we ran: INSERT ON CONFLICT DO UPDATE and DO NOTHING, the excluded row, conditional updates,…

Read article →
Databases & SQL

SQL LIKE Operator Explained: Wildcards, Case Sensitivity and Performance

The SQL LIKE operator explained with queries we ran: % and _ wildcards, escaping, NOT LIKE and NULL, case sensitivity…

Read article →
Artificial Intelligence

AI Hallucinations Explained: Why Language Models Make Things Up and How to Reduce It

AI hallucinations explained: what they are, why language models produce them, common types, how to reduce them with grounding and…

Read article →
Test Automation

Mocking in Python: unittest.mock, patch and the Mistakes That Make Tests Lie

Mocking in Python with unittest.mock, tested: Mock and return_value, side_effect, patching where a name is used, spec and autospec, mocking…

Read article →
Software Testing

Code Coverage Explained: Line vs Branch Coverage and What 100% Really Means

Code coverage explained with a real coverage.py run: line, branch and condition coverage, reading a report, why 100% coverage can…

Read article →
Artificial Intelligence

What Are AI Agents? How They Work, With a Simple Agent Loop You Can Run

What are AI agents? A plain guide to the agent loop, tools, memory and guardrails, with a small Python loop…

Read article →
Test Automation

TDD vs BDD: Key Differences, One Feature Built Both Ways and When to Use Each

TDD vs BDD explained with one discount feature built both ways: red-green-refactor with code we ran, Given-When-Then scenarios, tools, trade-offs…

Read article →
Software Testing

User Acceptance Testing (UAT): Process, Checklist and Real Examples

User acceptance testing explained: who runs it, how it differs from QA, a seven-step process, a UAT test case template,…

Read article →
Artificial Intelligence

What Are Embeddings? Vectors and Cosine Similarity Explained Simply

What are embeddings? A plain-language guide to vectors, cosine similarity and semantic search, with a small example we ran, common…

Read article →
Test Automation

Flaky Tests: What Causes Them and How to Fix Them for Good

Flaky tests explained with demos we ran: the main causes, how to confirm and diagnose one, proper fixes for timing,…

Read article →
Software Testing

Load Testing vs Stress Testing: Differences, Metrics and k6 Examples

Load testing vs stress testing explained: what each proves, spike and soak tests, the metrics that matter, why averages mislead,…

Read article →