top of page

Decision Tables and State Transition Testing: Designing Tests for Complex Business Rules | Amber Insights #018

4 days ago
12 min read
Conceptual decision table with rule and condition values beside connected circles labelled S0, S1, S2 and S3; Amber Insights Issue 018 by Amber Idumwonyi.

Introduction


A patient meets the booking criteria. The requested appointment has enough lead time. The slot appears available. The confirmation request succeeds. A second confirmation request arrives after the first response is lost. What should happen now?


The same input values can demand a different result because something has already happened. Equally, a request can fail because of a combination of conditions even before the system changes state. These are related problems in test design, but they need different models.


Issue 017 examined equivalence partitioning and boundary value analysis. This issue adds two ways of making the reasoning inspectable: a decision table for interacting conditions and a state model for behaviour that depends on history.


The Quality Engineer's contribution is to expose missing decisions, select meaningful investigations, and describe what the resulting evidence can support.


01. Establish the rule before drawing the model


The appointment booking examples in Issues 014 to 017 are educational illustrations, not verified requirements for a real healthcare service. Earlier discussions included avoiding double allocation and producing a confirmation after a successful booking. They did not establish an actual organisation's cancellation, retry, or eligibility policy.


We retain illustrative rule W1: a slot must begin at least 24 elapsed hours after the instant when the server makes its booking decision, using UTC and precision of one second. Issue 017 explored its boundary between whole seconds. Here, timing is one Boolean condition inside a larger decision; its boundary checks remain useful and are not replaced by this table.


For this article only, introduce teaching policy P1: a confirmation attempt with valid input formatting can confirm a draft reservation only when the patient is eligible, W1 is satisfied, and the slot can be allocated. Introduce P2: only an authorised owner can cancel a confirmed reservation.


Cancellation leads to a terminal Cancelled state for that reservation record. A repeated confirmation is rejected without a second allocation; a repeated cancellation is rejected without repeating cancellation effects.


P1 and P2 are new illustrative assumptions, not requirements inherited from Issue 014 or claims about an implemented service. A production system might deliberately return an earlier successful response on a retry. The QE must obtain that decision, rather than quietly treating this article's rejection policy as the correct product behaviour.


Our model excludes payment, waiting lists, rescheduling, notification delivery, administrative overrides, and slot reuse after cancellation. It describes one reservation record; it is not the lifecycle of the appointment slot or a complete booking platform.


02. Use a decision table to expose combinations

A decision table connects combinations of conditions to expected actions. In the usual orientation, condition and action rows are evaluated across rule columns. This makes an overlooked combination easier to discuss than a sentence containing several “and” and “unless” clauses.


For P1, define E as eligibility satisfied, T as the W1 timing condition satisfied, and A as allocation availability satisfied at the authoritative decision. Each is explicitly true or false. Missing values, failed lookups, and unknown availability are outside this Boolean domain and require separate decisions.


Three independent Boolean conditions produce eight combinations. Independence here is a modelling assumption: we have not established which combinations can be arranged in a real service. Start with all eight, then justify any infeasible combination with evidence. Do not remove an inconvenient row simply because its fixture is difficult to create.

Condition or action

R1

R2

R3

R4

E eligibility satisfied

F

T

T

T

T timing satisfied

—

F

T

T

A allocation available

—

—

F

T

Confirm and allocate

No

No

No

Yes

Refuse confirmation

Yes

Yes

Yes

No

This is a compact, disjoint table for the binary confirmation outcome. T means true, F means false, and — means either value produces the same action within this model. R1 represents four combinations, R2 two, R3 one and R4 one: 4 + 2 + 1 + 1 = 8. The companion editable table retains every expanded combination.

Design ID

E

T

A

Compact rule

Expected action

Product execution

DT-018-01

False

False

False

R1

Refuse confirmation

Not run

DT-018-02

False

False

True

R1

Refuse confirmation

Not run

DT-018-03

False

True

False

R1

Refuse confirmation

Not run

DT-018-04

False

True

True

R1

Refuse confirmation

Not run

DT-018-05

True

False

False

R2

Refuse confirmation

Not run

DT-018-06

True

False

True

R2

Refuse confirmation

Not run

DT-018-07

True

True

False

R3

Refuse confirmation

Not run

DT-018-08

True

True

True

R4

Confirm and allocate

Not run

The disjoint grouping prevents a request matching several rule columns. It does not specify implementation evaluation order or precedence of error messages. For example, E false and T false falls under R1, but P1 does not say that an eligibility message must take priority over a timing message.


03. Challenge every simplification


A colleague might explain R1 as “E false, ignore everything else”. That is valid for our two actions because every such combination refuses confirmation. It is not automatically valid if the table also governs audit events, support routing, messages, or retry advice. Those outcomes may depend on the conditions we have hidden.


Ask which observable behaviour is being preserved by the merge. A dash expresses a judgement about irrelevance for that behaviour; it does not mean “unknown”, “not tested” or “do not care about the risk”. Record why the merge is justified and what it excludes.


Likewise, a timeout from an eligibility service cannot be substituted for E false unless an agreed policy defines that treatment. An unavailable dependency and a patient who is ineligible can require different recovery actions. Adding an “unknown” value would change both the domain and the table; it deserves an explicit revision.


Our four compact columns are useful for explaining the rule. The eight expanded rows are useful for checking the grouping and planning distinct fixtures. Neither format automatically gives an exhaustive test suite for a real booking journey.

Eight E T A Boolean combinations become four disjoint rules: R1 represents four, R2 two, R3 one and R4 one. Only R4 confirms.
Figure 1. Eight Boolean combinations are grouped into four disjoint outcome rules. The compression preserves only the stated confirm/refuse decision; additional outcomes need review.


04. Turn columns into investigations


For R4, construct an eligible synthetic patient, a fresh allocatable slot, and a controlled clock for the server's decision. Choose a lead time comfortably above the threshold when the investigation is about the combination, then retain Issue 017's boundary checks as separate data selections.


For R3, keep E and T true while making allocation unavailable. Verify refusal and absence of a new allocation. A generic error banner alone is weak evidence: a request could be refused because the service was down, leaving the allocation rule unexamined.


For R2, use E true and T false. Investigate both availability values if the expanded combination set is the intended design scope. For R1, similarly, retain all four combinations when reviewing interactions. A compact design with four columns and an expanded design with eight rows have different coverage denominators; label them accurately.


Use stable design identifiers and specify the observations that matter. A confirmation response should agree with the authoritative reservation and allocation records. A refusal should leave those records unchanged for this attempt. Decide with engineering how those observations can be obtained through an authorised interface, without relying on private production data.


A useful review question is: “Could the system return the expected message while making the wrong state change?” If the answer is yes, improve the observation before adding more input rows.


05. Introduce history with a reservation state model


Now hold the request data constant and change the reservation's history. Confirming a Draft record can be meaningful; confirming the same record after it is already confirmed is a different operation under P2.


Our simplified model has three states. Draft means the record has not been confirmed and has no allocation from confirmation. Confirmed means confirmation and allocation have succeeded. Cancelled means the record has been cancelled and cannot be confirmed again within this model. A new booking would use a new record.


There are two events: confirm and cancel. The confirm guard G is E AND T AND A. The cancel guard O means that the caller is the authorised owner. This teaching model assumes confirmation authorisation, and request validity have already been checked; G is not a complete rule for access control.


We label the two accepted transitions as follows:

  • T1: Draft → Confirmed on confirm [G true] / confirm and allocate.

  • T2: Confirmed → Cancelled on cancel [O true] / cancel once.


An event names what is requested; a guard states an additional condition for accepting it; an action describes the resulting effect. The W3C SCXML specification formalises events, conditions, and executable transition content, but this diagram is a teaching model, not an SCXML implementation.

Simplified reservation record progresses from Draft to Confirmed on confirm with G true, then to Cancelled on owner cancellation. Rejected attempts are specified separately.
Figure 2. Simplified model of a reservation record under illustrative P1/P2. Only the two accepted transitions that change state are drawn. Rejected attempts and their expected effects are specified in the accompanying table. This is not a complete service state transition model.

06. Specify refusals as carefully as successful paths


A diagram with two arrows leaves important questions unanswered. What happens when the owner cancels a Draft? Can a Cancelled record be confirmed again? Does a failed guard leave state unchanged? Our illustrative policy makes those answers explicit:

Current state

Event and guard

Expected next state

Expected effect

Draft

confirm, G true

Confirmed

Confirm and allocate once

Draft

confirm, G false

Draft

Refuse; no allocation

Draft

cancel, either O value

Draft

Refuse; no cancellation effect

Confirmed

confirm, either G value

Confirmed

Refuse; no second allocation

Confirmed

cancel, O true

Cancelled

Cancel once

Confirmed

cancel, O false

Confirmed

Refuse; no cancellation effect

Cancelled

confirm, either G value

Cancelled

Refuse; no allocation

Cancelled

cancel, either O value

Cancelled

Refuse; no repeated cancellation effect

The table is complete only for the stated three states, two events, and Boolean guards. Unknown events, missing records, malformed identifiers, and authorisation failures outside O remain outside scope. The editable expansion has 12 state/event/guard rows: six for confirm with G true or false, and six for cancel with O true or false.

Design ID

Current state

Event

Guard

Next state

Action

Product execution

GT-018-01

Draft

confirm

G=False

Draft

Refuse; no allocation/cancellation effect

Not run

GT-018-02

Draft

confirm

G=True

Confirmed

Confirm and allocate once

Not run

GT-018-03

Draft

cancel

O=False

Draft

Refuse; no allocation/cancellation effect

Not run

GT-018-04

Draft

cancel

O=True

Draft

Refuse; no allocation/cancellation effect

Not run

GT-018-05

Confirmed

confirm

G=False

Confirmed

Refuse; no allocation/cancellation effect

Not run

GT-018-06

Confirmed

confirm

G=True

Confirmed

Refuse; no allocation/cancellation effect

Not run

GT-018-07

Confirmed

cancel

O=False

Confirmed

Refuse; no allocation/cancellation effect

Not run

GT-018-08

Confirmed

cancel

O=True

Cancelled

Cancel once

Not run

GT-018-09

Cancelled

confirm

G=False

Cancelled

Refuse; no allocation/cancellation effect

Not run

GT-018-10

Cancelled

confirm

G=True

Cancelled

Refuse; no allocation/cancellation effect

Not run

GT-018-11

Cancelled

cancel

O=False

Cancelled

Refuse; no allocation/cancellation effect

Not run

GT-018-12

Cancelled

cancel

O=True

Cancelled

Refuse; no allocation/cancellation effect

Not run

“Invalid transition” must not become an ambiguous shorthand for “the software crashes”. Here, it means an attempted state change disallowed by P1/P2. The expected response is controlled refusal and preserved state. We deliberately record these attempts rather than drawing misleading arrows that suggest they are accepted transitions.


A rejected attempt with unchanged state may still create a legitimate audit entry. Our phrase “no allocation” does not mean “no observable activity of any kind”. That distinction matters when choosing assertions.


07. Design sequences that establish their own starting state


A test based on state needs a reproducible path to the required state, not just a label in a spreadsheet. Use separate records for independent investigations, and verify the precondition before sending the target event.

Design

Preparation and target sequence

Key observations

ST-018-01

Fresh Draft; confirm with G true; cancel with O true

Draft → Confirmed → Cancelled; one allocation and one cancellation effect

ST-018-02

Fresh Draft; attempt confirm with G false

Refusal; remains Draft; no allocation

ST-018-03

Fresh Draft; attempt cancel with O true

Refusal; remains Draft; no cancellation effect

ST-018-04

Reach Confirmed; attempt confirm again with G true

Refusal; remains Confirmed; no duplicate allocation

ST-018-05

Reach Confirmed; attempt cancel with O false

Refusal; remains Confirmed; no cancellation effect

ST-018-06

Reach Cancelled; attempt confirm with G true

Refusal; remains Cancelled; no allocation

ST-018-07

Reach Cancelled; attempt cancel again with O true

Refusal; remains Cancelled; no repeated effect

These seven sequences are selected risk examples, not every row in the expansion with 12 rows. Their preparation steps can exercise accepted transitions, but a setup failure must not be counted as a successful target investigation. Where an attempt is expected to be refused, keep one such target attempt per independent case, so an earlier failure does not hide the next observation.


ST-018-01 visits all three states and both accepted arrows. That achievement says nothing about the risk of duplicate allocation examined by ST-018-04. A suite that takes every arrow along the successful path can still mishandle a repeat request.


08. Separate model coverage from product confidence


ISTQB distinguishes state coverage, coverage of valid transitions, and coverage that also attempts invalid transitions. Those criteria describe different obligations; visiting every state is weaker than investigating every transition. Decision table coverage likewise depends on the feasible rule columns selected for the model.


For our package, name the exact inventory: eight expanded Boolean decision rows, four compact rules, three reservation states, two accepted arrows, and 12 expanded state/event/guard rows. The last inventory is a measure of guarded attempts defined for this package, not an assertion that we have implemented a universal “all transitions” metric.


Every product execution field in the companion registers is Not run. Designed examples are not executed coverage. A future report must distinguish the model version, planned rows, actual observations, failed setup, and outstanding decisions. A complete percentage against a small model cannot establish product completeness or quality.


The supplied local verification is limited to checking the arithmetic, verifying that each combination matches one compact rule, and exercising the teaching transition function with selected sequences. It is deliberately separate from product execution evidence. No real booking interface, database, clock or notification service has been tested.


09. Investigate the race that the sequential model omits


A can be true when two callers look at a slot. A diagram containing Draft → Confirmed does not demonstrate that their competing allocation attempts are handled correctly. The truth of a condition at an earlier read is not proof that it remains true when a change commits.


Design a separate concurrency investigation using two eligible synthetic patients and one slot, controlled overlap between requests, and an agreed observation of the committed outcome.


Under the earlier expectation that a slot cannot be allocated twice, at most one reservation should acquire that slot. The losing request's response and any retry behaviour still require an agreed contract.


A sequential teaching function cannot verify this property. Nor does drawing “atomic” beside an arrow make the implementation atomic. Discuss the actual mechanism with engineering and test its observable guarantees. PostgreSQL's documentation, for example, explains transaction isolation behaviour and the need to retry entire transactions after serialization failures. That is context specific to that implementation, not evidence that our hypothetical booking service uses PostgreSQL or serializable transactions.


Similarly, a lost response creates uncertainty for the client. Whether retrying returns the original confirmation, refuses the repeat, or needs another recovery route is a product decision. P2 selected refusal for teaching clarity; a real contract could differ. Test both the response policy and absence of unintended repeated effects once that contract is agreed.


10. Make unresolved decisions visible and owned


The most useful output from modelling may be a question the team had not realised it needed to answer. Maintain a decision log alongside the tables, with proposed owners and the affected designs.

Decision

Why it matters

Suggested owner

Current position

Retry contract

Determines expected responses to repeated confirmation and cancellation requests

Product Owner and Engineering Lead

P2 illustrative; real policy unresolved

Error precedence and unknown conditions

Determines whether compact rules preserve all required outcomes

Product Owner and QE

Excluded from binary model

Cancellation side effects and slot reuse

Separates reservation history from slot lifecycle

Product Owner and Engineering Lead

Outside current model

Allocation atomicity and observation

Determines how to investigate competing requests

Engineering Lead and QE

Product mechanism unverified

Authorisation beyond owner cancellation

Prevents Boolean eligibility being confused with access control

Security Lead and Product Owner

Precondition; real controls unresolved

These roles are suggestions for a delivery team, not assignments to named colleagues or claims that anyone has accepted responsibility. Unresolved policy is not a failed software test. It is a design dependency that limits which expected results can be approved for a real implementation.


Review the models with product, engineering, and relevant operational specialists. Ask them to challenge the state definitions, event order, guards, excluded outcomes, and feasibility claims. Preserve earlier versions when a decision changes; do not silently reinterpret old results against the new policy.


11. Use the models to improve the conversation


A practical review can start with one request: explain why a particular combination should confirm, then explain why the same request should behave differently after confirmation. Follow that explanation through the table, the state history, and the evidence the test will collect.


When those three disagree, the QE has found useful work before execution: an unclear rule, a missing state distinction, or an observation that cannot support its claim. Resolve the disagreement rather than adding rows to make the spreadsheet look comprehensive.


Decision tables and state models earn their place when another engineer can inspect the reasoning, challenge a simplification, and reproduce the intended investigation. Issue 019 will develop the traceability from those business decisions to test evidence. For now, keep the rule, history, and scope visible enough that a coverage claim can be questioned intelligently.


About the author

Amber Idumwonyi is a senior Quality Engineering leader and founder of LEMP. Her work spans enterprise software delivery, UK public sector technology programmes, test strategy, automation, accessibility, governance, and technology workforce development. Amber Insights shares practical Quality Engineering knowledge for technology professionals and those developing their skills.


Read More:

Comments


bottom of page