~/qa-guides

~/qa-guides/state-transition-testing

>_ State Transition Testing: Examples and Test Cases

Build executable test sequences from states, events, guards, and actions, with three worked models, coverage calculations, and 15 complete test cases.

Test designState transitionsTest casesCoverage

Published

Short answer

State transition testing derives tests from a model of states and the events that move a system between them. It checks whether an action is accepted in the current state, whether the resulting state is correct, and whether the required effects occur.

The same action may succeed before a workflow completes and be forbidden afterwards. A useful test therefore records the starting state, the event sequence, applicable conditions, and expected results after each step.

This guide develops three explicit models: an order, a request for approval, and asynchronous file processing. It includes coverage calculations, 15 worked test cases, and checks for retries, duplicate actions, competing events, and stale results. The models use example business rules; adapt them to the actual product contract.

What a state model describes

Use four terms consistently:

  • State: The modeled condition of the object, such as Draft or Approved.
  • Event: An input or occurrence evaluated by the system.
  • Guard: A condition that must hold for a transition.
  • Action: An effect associated with the transition.

Section 4.2.4 of the ISTQB Foundation Level syllabus v4.0.1 describes event-driven models, guard conditions, and deriving tests as event sequences. The transition identifiers and business examples below are defined for this guide.

For example, cancellation while an order is Submitted can be permitted, while cancellation after it is Shipped can be rejected. Testing only the Cancel button without establishing the order's current state leaves the expectation undefined.

For the broader relationship between specification-based and structure-based techniques, see Black-Box vs White-Box Testing. Here, the practical task is to construct a model and turn it into executable sequences.

How to derive tests from workflow requirements

1. Choose one object and define the model boundary

Start with a specific object, such as one order or one processing job. Decide which events belong to its lifecycle and which related operations are outside the model.

An order and its payment may have separate states. A confirmed order does not, by itself, tell you whether a payment was captured, refunded, or never required. Model those relationships explicitly when they affect the requirement; do not compress different objects into one ambiguous status label.

Write down where the modeled lifecycle starts and ends. In the file example below, transfer has already finished before the first state. File selection and network transfer belong to the surrounding upload workflow.

2. Name observable states and reachable starting points

Identify how each state can be established and independently observed. A label displayed in the UI may lag behind persisted data or reflect only a local optimistic update.

Record the initial state, the allowed paths into later states, and any final states. Finality is relative to the declared event set: an order may be final for fulfillment while another process can still manage a return.

If tests create a fixture directly in an intermediate state, verify its supporting data too. A Confirmed order without its required reservation is not equivalent to one reached through the normal workflow.

3. List events, guards, and effects separately

For each event, identify the source state, required conditions, destination, and effects. Give each allowed transition a stable identifier so test results can point to a specific rule.

Distinguish an event that is forbidden in a state from an event permitted there when its guard passes. Confirming a Submitted order with no stock is a different failure condition from confirming an already Shipped order.

Also specify what must remain unchanged on rejection. Depending on the example, this includes a reservation, a review decision, a published file, or a saved association. An error response alongside a committed business action is not a passing negative test.

4. Resolve missing combinations before assigning expectations

Work through each relevant state and event combination. Ask whether it should transition, remain unchanged with an accepted result, or be rejected.

Do not silently interpret a missing requirement as rejection. A duplicate callback might require acknowledgment without another action, whereas a fresh command to repeat a completed operation might require a conflict response.

Record unresolved combinations as requirement questions. Tests should compare behavior with an agreed rule rather than preserve an accidental implementation choice as the expected result.

5. Select routes and isolate negative attempts

Build routes that cover the required transitions while keeping setup understandable. A single route can verify several edges, but it may not reach cancellation branches or alternative outcomes.

Give each negative attempt a known source state. After a forbidden event, inspect the object before sending anything else. If the invalid action corrupts state, later failures in one long script become difficult to attribute.

Separate fresh test executions from route setup. Document whether setup transitions contribute to the reported coverage and keep that convention consistent across the suite.

6. Define reset, evidence, and completion rules

Record how to reset the object, queues, and test doubles between executions. Specify which response, persisted state, and downstream effects establish completion.

For asynchronous actions, choose a documented completion signal or bounded observation window. A request being accepted does not establish that a worker completed its transition.

Keep model version, object ID, event identity, relevant data version, and observed effects with the result. This evidence helps distinguish an incorrect transition from a stale UI, delayed read, or callback associated with a different attempt.

Worked model 1: An order with cancellation branches

States and example rules

The model has five states: Draft, Submitted, Confirmed, Shipped, and Cancelled. Every fresh order starts in Draft. Each order contains one unit of a test product.

The event set is Submit, Confirm, Ship, and Cancel. Submit requires complete item and delivery information. Confirm requires one available unit of stock. Other fields and caller permissions are valid in these examples.

Confirmation creates one reservation for this order. Shipping consumes that reservation and creates one shipment. Cancelling a Confirmed order releases its reservation; cancelling earlier creates no release because there was no reservation.

Shipped and Cancelled are final for these four events. Every unlisted state and event combination is rejected without changing the order or its business effects. These are deliberately bounded fulfillment rules, not universal e-commerce requirements.

The six allowed transitions

  • O1: Draft + Submit -> Submitted. With complete order data, record the submitted details; create no reservation or shipment.
  • O2: Draft + Cancel -> Cancelled. Close the draft without a reservation or shipment.
  • O3: Submitted + Confirm -> Confirmed. With stock available, create one reservation for the order.
  • O4: Submitted + Cancel -> Cancelled. Close the submitted order without reserving stock.
  • O5: Confirmed + Ship -> Shipped. Consume the reservation and create one shipment.
  • O6: Confirmed + Cancel -> Cancelled. Release the reservation once and create no shipment.

Read each transition as an event evaluated against the current saved state. Receiving Ship while Submitted must not silently execute Confirm first. That would skip a required business decision and make the observed route different from the declared model.

Four useful execution routes

  • Route P1: O1, O3, O5. Submit, confirm, and ship a fresh order.
  • Route P2: O2. Cancel a fresh draft.
  • Route P3: O1, O4. Submit a fresh order, then cancel it.
  • Route P4: O1, O3, O6. Submit, confirm, then cancel a fresh order.

Use different order IDs for these routes. Reusing the Shipped result from P1 as P2's starting object would test a forbidden cancellation rather than draft cancellation.

Calculate state transition coverage on that model

State coverage and valid transition coverage

State coverage counts distinct modeled states visited. Valid transition coverage counts distinct allowed transitions exercised. All-transition coverage includes allowed and forbidden entries in the declared transition matrix. In each case, divide covered items by the corresponding total and state the model scope.

For the order model, executing only P1 and P2 gives:

  • States visited: Draft, Submitted, Confirmed, Shipped, and Cancelled; 5 / 5 = 100% state coverage.
  • Allowed transitions exercised: O1, O2, O3, and O5; 4 / 6 = 66.7% valid transition coverage, rounded to one decimal place.
  • Allowed transitions still missing: O4 and O6, the cancellations after submission and confirmation.

These two missing edges have different effects. O4 must cancel without a reservation, whereas O6 must release an existing reservation. Visiting Cancelled through O2 establishes neither of those results.

Adding P3 exercises O4, bringing the distinct transition count to five of six. Adding P4 exercises O6 and completes the six allowed transitions. Repeated execution of O1 or O3 does not add new items to that denominator.

Define a finite matrix before claiming all-transition coverage

For this calculation, use the five states and four declared events, giving 20 state and event combinations. Supply passing guard data wherever a guard is applicable: complete order data and available stock. Failing-guard variants are additional tests outside this particular matrix.

Six combinations are allowed, as listed above. The remaining 14 are forbidden:

  • From Draft: Confirm and Ship.
  • From Submitted: Submit and Ship.
  • From Confirmed: Submit and Confirm.
  • From Shipped: Submit, Confirm, Ship, and Cancel.
  • From Cancelled: Submit, Confirm, Ship, and Cancel.

The four positive routes cover six of the 20 matrix entries, or 30%. Add an independent attempt for each forbidden entry, verify its rejection and unchanged business state, and the declared matrix reaches 20 / 20 = 100% all-transition coverage.

That percentage applies to this four-event abstraction. It excludes failing guards, alternate data values, request replays, and concurrent execution. Expand the model or report separate measures when those distinctions form part of the intended coverage.

Separate edge coverage from sequence risks

Exercising every edge does not exercise every possible history. Repeated review cycles, retries, and overlapping events can depend on data that a coarse state label does not reveal.

For example, a Submitted order could be processed twice by different workers even though each worker individually follows O3. The modeled destination looks correct, but two reservations violate the required effect.

Use the edge inventory to establish systematic baseline coverage, then select additional histories from the product's risks. Avoid describing an arbitrary number of test cases as complete coverage without identifying what those cases cover.

Worked model 2: Approval with a return-for-changes loop

States, revisions, and decisions

An approval request starts in Draft. Its other states are InReview, ChangesRequested, Approved, and Withdrawn. The author edits only in Draft or ChangesRequested; each submitted revision is frozen while it is under review.

The events are Submit, RequestChanges, Resubmit, Approve, and Withdraw. A submission must have its required fields. RequestChanges requires a review note. Approval requires an assigned reviewer and the exact revision currently under review.

Every review decision includes its revision ID. A decision for revision 1 cannot approve revision 2 after a resubmission. Approved and Withdrawn are final for the declared events; reopening is outside this example's rules.

The seven allowed transitions

  • A1: Draft + Submit -> InReview. With complete fields, freeze revision 1 and open its review task.
  • A2: InReview + RequestChanges -> ChangesRequested. With a review note, close the current review task and notify the author once.
  • A3: ChangesRequested + Resubmit -> InReview. With a complete newer revision, freeze that revision and open its review task.
  • A4: InReview + Approve -> Approved. With an assigned reviewer and matching revision, close the review task, store one approval decision, and emit one approval notice.
  • A5: Draft + Withdraw -> Withdrawn. Close the draft without opening a review task.
  • A6: InReview + Withdraw -> Withdrawn. Close the active review task without approving the request.
  • A7: ChangesRequested + Withdraw -> Withdrawn. Close the request without creating another review task.

All other fresh state and event combinations are rejected without business-state changes. A false guard also prevents its transition. Two independent approval commands may compete, but only one can commit A4 for a request.

Why the loop needs versioned evidence

A complete rework route is A1, A2, A3, A4. It revisits InReview, but the second visit concerns a different frozen revision.

Checking only the destination label misses a stale decision for the earlier revision. Record both state and revision after Resubmit, then deliberately send an approval referencing the old revision before sending a current decision.

For repeated rework, run A2 and A3 again with revision 3. Check that review tasks, decisions, and notifications still refer to the correct revision. Loop counts should reflect product risks and limits rather than an assumption that one successful cycle proves all future cycles.

Worked model 3: Asynchronous file processing

States, attempts, and the publication rule

This model begins after the file's bytes have been stored privately. Its states are Uploaded, Processing, Ready, Failed, Rejected, and Deleted. Uploaded is the initial state; Deleted is the only state with no further allowed transitions.

The events are Start, Pass, Fail, Reject, Retry, and Delete. Start creates attempt 1. Retry is permitted after a technical failure while fewer than two attempts have started; it creates a new attempt ID.

Pass, Fail, and Reject apply only to the active Processing attempt. A timeout is a technical Fail event for that attempt. A content-policy rejection is Reject and cannot be retried through Retry in this model.

Only Ready permits application download. Delete immediately blocks access and marks the object for cleanup, including any derived preview. The cleanup deadline is a separate product requirement and does not change the transition's access result.

The ten allowed transitions

  • F1: Uploaded + Start -> Processing. Create attempt 1 without publishing the file.
  • F2: Processing + Pass -> Ready. For the active attempt, publish one approved output and enable its permitted download.
  • F3: Processing + Fail -> Failed. For the active attempt, record the technical failure and publish no output.
  • F4: Processing + Reject -> Rejected. For the active attempt, record the content rejection and publish no output.
  • F5: Failed + Retry -> Processing. When the attempt limit allows it, create the next attempt with a new ID.
  • F6: Uploaded + Delete -> Deleted. Block access and schedule the original data for cleanup.
  • F7: Processing + Delete -> Deleted. Invalidate the active work and prevent it from publishing an output.
  • F8: Ready + Delete -> Deleted. Revoke application download and schedule original and derived data for cleanup.
  • F9: Failed + Delete -> Deleted. Block access and schedule retained failure data for cleanup.
  • F10: Rejected + Delete -> Deleted. Block access and schedule rejected data for cleanup.

Unlisted ordinary commands are rejected. Outdated or duplicate worker callbacks are acknowledged and ignored when they no longer apply to the active Processing attempt. That accepted no-op is not an extra transition in this edge inventory; model it explicitly as a self-loop if its effects need their own edge coverage measure.

Keep the worker result attached to its attempt

An event saying only "file passed" is insufficient for the stale-result test. It needs a file ID, an attempt ID, and a result identity that can be compared with the current work.

After F3 and F5, attempt 1 must not complete attempt 2's work. After F7, neither attempt may make the Deleted file Ready. These checks concern event applicability and history as well as the visible status.

The File Upload Testing Checklist covers the surrounding transfer, attachment, retrieval, and cleanup workflow. This model isolates how processing events change the file's state and publication eligibility.

Fifteen worked state transition test cases

Each case follows the model rules above. Use a fresh object for each independent execution or parameterized variant. Establish permissions and unrelated data as valid so a different failure cannot mask the transition being tested.

Test case 1: Submit, confirm, and ship an order

  • Preconditions: A fresh Draft order contains one available test unit and complete delivery information; it has no reservation or shipment.
  • Steps: Send Submit, inspect the order, send Confirm, inspect again, then send Ship and read the saved order and effects.
  • Expected sequence: Draft, Submitted, Confirmed, Shipped through O1, O3, and O5.
  • Expected effects: Submission creates no reservation. Confirmation creates one. Shipping consumes it and creates exactly one shipment; no active reservation remains for this order.
  • Evidence: Record the order ID, each response, each observed state, and the reservation and shipment identifiers.

Test case 2: Cancel a draft without touching stock

  • Preconditions: A fresh order is Draft, with no submission, reservation, or shipment.
  • Steps: Send Cancel and read the order plus its reservation and shipment records.
  • Expected sequence: Draft, Cancelled through O2.
  • Expected effects: No reservation, release, or shipment is created. The order remains Cancelled after reload.
  • Evidence: Associate the cancellation result with this draft's ID rather than a fixture left by the normal fulfillment case.

Test case 3: Cancel after submission

  • Preconditions: A fresh Draft order has complete data; stock and permissions are valid.
  • Steps: Send Submit, verify Submitted, then Cancel and inspect the resulting business records.
  • Expected sequence: Draft, Submitted, Cancelled through O1 and O4.
  • Expected effects: No reservation or shipment exists for the order, and no reservation-release action is emitted.
  • Evidence: Retain the intermediate Submitted observation so an unintended direct draft cancellation cannot satisfy this case.

Test case 4: Cancel a confirmed order and exercise dispatch competition

  • Preconditions: A fresh valid order reaches Confirmed through O1 and O3, with one active reservation.
  • Steps: First run ordinary Cancel. In separate fresh variants, hold Ship and Cancel at the decision boundary and release them in each defined order.
  • Expected ordinary result: O6 leads to Cancelled, releases the reservation once, and creates no shipment.
  • Expected competing results: If Cancel commits first, Ship is rejected and there is no shipment. If Ship commits first, Cancel is rejected, state is Shipped, and the reservation is consumed rather than released.
  • Evidence: Record the winning event and effects. Neither execution may both ship the order and release its reservation as a cancellation.

Test case 5: Reject every forbidden order event

  • Preconditions: Independently prepare each source state with its supporting data; supply otherwise valid event inputs.
  • Variants: Draft with Confirm or Ship; Submitted with Submit or Ship; Confirmed with Submit or Confirm; Shipped with each of the four events; Cancelled with each of the four events.
  • Steps: Attempt one forbidden event per fresh variant, then read the order and compare its business effects with the pre-attempt baseline.
  • Expected result: All 14 attempts are rejected. State, reservation, shipment, and cancellation effects remain unchanged for each source object.
  • Evidence: Report each matrix entry separately. An aggregate "negative case passed" without identifying the attempted combinations cannot establish matrix coverage.

Test case 6: Keep an allowed transition blocked by a false guard

  • Preconditions: Prepare two independent objects: a Draft order missing delivery information and a Submitted order whose required unit is unavailable.
  • Steps: Attempt Submit on the first object and Confirm on the second; inspect each object immediately afterwards.
  • Expected result: The incomplete draft remains Draft with no submission effects. The stock-constrained order remains Submitted with no reservation or shipment.
  • Recovery check: Correct the missing data or restore stock in the corresponding fresh continuation, then retry. O1 or O3 should succeed with its defined effects.
  • Evidence: Label these as guard variants, separate from the 20-entry structural matrix using passing guard data.

Test case 7: Approve the submitted revision

  • Preconditions: A complete approval request is Draft; an assigned reviewer is available.
  • Steps: Submit revision 1, verify InReview and its review task, then Approve referencing revision 1.
  • Expected sequence: Draft, InReview, Approved through A1 and A4.
  • Expected effects: One approval decision names revision 1, the active review is completed, and one approval notice is emitted.
  • Evidence: Compare the revision in the request, review task, and decision rather than checking only the Approved label.

Test case 8: Return for changes and reject an old decision

  • Preconditions: A fresh request starts in Draft with complete revision 1 and assigned reviewers.
  • Steps: Submit, RequestChanges with a note, edit to complete revision 2, and Resubmit. Attempt Approve for revision 1, inspect the result, then Approve for revision 2.
  • Expected sequence: A1, A2, A3 returns the request to InReview. The old decision is rejected without leaving that state; the current decision performs A4.
  • Expected effects: The approval names revision 2 only. The earlier review task is closed, a current review task exists for the new cycle, and there is one effective approval notice.
  • Evidence: Preserve both decision inputs and the revision observed after each response.

Test case 9: Withdraw at each permitted approval stage

  • Preconditions: Use fresh variants starting in Draft, InReview after A1, and ChangesRequested after A1 and A2.
  • Steps: Send Withdraw from each source, then attempt a fresh Approve command against the resulting request.
  • Expected transitions: A5, A6, and A7 respectively reach Withdrawn; the later approval attempt is rejected.
  • Expected effects: No approval decision or approval notice exists, and no review task remains active for the withdrawn request.
  • Evidence: Record the source state for each variant so one successful withdrawal does not stand in for the other two branches.

Test case 10: Commit only one of two competing approvals

  • Preconditions: Revision 1 is InReview; two assigned reviewers can independently approve it.
  • Steps: Prepare two distinct approval commands for that revision. Hold both before the commit decision, then release them with controlled overlap and read the resulting request and decisions.
  • Expected result: One command performs A4. The other is rejected and cannot create another decision after the request becomes Approved.
  • Expected effects: One effective approval decision and one approval notice exist for the request, whichever reviewer wins.
  • Evidence: Use different command identities. This case tests competing decisions, not replay of one request with the same identity.

Test case 11: Publish only after a current processing success

  • Preconditions: A stored private file is Uploaded, with no processing attempt or published output.
  • Steps: Start processing, verify Processing and attempt 1, then deliver Pass for that active attempt.
  • Expected sequence: Uploaded, Processing, Ready through F1 and F2.
  • Expected effects: The file is unavailable for application download until Pass is applied; afterwards one approved output is available under the example's access rules.
  • Evidence: Record the attempt ID and output identity so another file's success cannot satisfy the observation.

Test case 12: Retry a technical failure within the attempt limit

  • Preconditions: A fresh Uploaded file uses the two-attempt rule; test controls can emit a timeout for the active attempt.
  • Steps: Start attempt 1, emit its timeout, inspect Failed, send Retry, verify a new attempt ID, then deliver its Pass result.
  • Expected sequence: F1, F3, F5, F2 reaches Ready. The timeout publishes nothing; only attempt 2 can publish the approved output.
  • Limit variant: In a fresh execution, fail both attempts and request Retry again. It is rejected, state remains Failed, and no third attempt starts.
  • Evidence: Keep the distinct attempt IDs and the attempt count; a displayed "retried" message alone does not establish the correct sequence.

Test case 13: Do not retry a content rejection as a technical failure

  • Preconditions: A fresh file is Uploaded, with processing controls available for a content-policy rejection.
  • Steps: Start processing, deliver Reject for the active attempt, then request Retry.
  • Expected sequence: F1 and F4 lead to Rejected. Retry is rejected without executing F5.
  • Expected effects: There is no new processing attempt, approved output, or application download. The recorded reason remains the content rejection.
  • Evidence: Distinguish this reason and state from Failed so an implementation that retries every unsuccessful result cannot pass.

Test case 14: Delete from each nonfinal file state

  • Preconditions: Prepare independent Uploaded, Processing, Ready, Failed, and Rejected files with the required supporting data.
  • Steps: Send Delete in each variant. For the Processing variant, deliver a delayed Pass for the cancelled attempt after deletion. Attempt application download in every variant.
  • Expected transitions: F6, F7, F8, F9, and F10 respectively reach Deleted.
  • Expected effects: Download is denied in all variants. The delayed result is acknowledged without publication or state resurrection; original and derived data are scheduled for cleanup under the product's deadline.
  • Evidence: Report each source state and any prior output identity, especially the Ready file whose download previously worked.

Test case 15: Ignore an earlier attempt's late success

  • Preconditions: A fresh file has failed attempt 1 through F1 and F3; Retry has started attempt 2 through F5.
  • Steps: While attempt 2 is Processing, deliver Pass for attempt 1. Read state and outputs, then deliver Pass for attempt 2 and repeat that same callback once.
  • Expected result: The first callback is acknowledged but leaves attempt 2 Processing with no published output. The current callback performs F2 and reaches Ready.
  • Expected effects: Repeating attempt 2's callback has no additional business effect; there is one approved output and no return to an earlier attempt.
  • Evidence: Retain both attempt IDs, callback identities, intermediate observations, and the final output count.

The positive variants in these cases exercise all six O transitions, seven A transitions, and ten F transitions. Only the order example includes an exhaustive forbidden-entry set. The approval and file cases select specific negative risks rather than claiming exhaustive all-transition coverage for those models.

Check histories that a simple status assertion can miss

Distinguish a rejected command, an accepted no-op, and a replay

A rejected command should expose the agreed failure outcome without committing the forbidden business action. It may still create diagnostic or audit evidence; "unchanged" refers to the business fields and effects being asserted.

An accepted no-op intentionally preserves business state, such as the file model's acknowledgment of an outdated callback. A replay returns the result of an earlier logical operation under the product's replay policy.

Record which behavior the contract requires. Do not count a replay as another execution of the original edge, and do not accept a fresh duplicate command merely because replay is supported for matching operation identities.

Exercise repeated actions with distinct identities

After a successful approval, send another fresh approval command. After shipping, send another fresh Ship command. These attempts target final-state rules and duplicate side effects.

Then separately repeat the original request identity if the interface promises replay handling. Check the replay window and payload rules explicitly; the three models do not prescribe a universal request-token mechanism.

A disabled button can prevent a user from sending a duplicate through that page, but service enforcement still needs observation. For endpoint-level workflow checks, the API Testing Checklist supplies the surrounding request, response, and business-data review.

Control event ordering instead of depending on timing luck

For a known race, identify the read, decision, and commit points that matter. Use approved test controls to arrange both relevant orderings or synchronize the competing requests near that decision.

In the order example, Cancel winning before Ship and Ship winning before Cancel have different permitted outcomes. Both must preserve the reservation and shipment invariants defined by the model.

Sending two requests rapidly once is weak evidence that the critical overlap occurred. Record the actual ordering and final effects so an ordinary sequential execution is not reported as a demonstrated concurrency test.

Check versions and attempt identities alongside state

Two observations of InReview can refer to different revisions. Two observations of Processing can refer to different attempts. Carry those identities through test inputs and assertions.

Look for results associated with older revisions, earlier workers, or objects replaced while work was pending. A correct status label combined with an incorrect revision or output can still violate the workflow.

When a service exposes a version used for conditional updates, keep it with the evidence. Define stale-version behavior in the contract rather than treating every conflict as a network failure worth resubmitting blindly.

Verify eventual results and invariants separately

If reads are eventually consistent, use the documented read or completion mechanism and a bounded wait. A stale UI immediately after an accepted command is different from a permanently incorrect committed result.

Still assert invariants that must hold throughout the workflow, such as no published output from a deleted processing attempt. Reaching Ready eventually does not excuse an earlier exposure forbidden by the model.

For timer-triggered events, control the evaluation clock and define when the timeout becomes applicable. Boundary Value Analysis: Examples and Test Cases explains how to choose exact neighbors when a transition guard includes a time or numeric limit.

Reusable state transition test case template

Record these fields so another tester can reproduce the same route:

  • Model and version: The workflow rules, event alphabet, transition IDs, and coverage scope.
  • Starting condition: Object ID, source state, relevant revision or attempt, and supporting business data.
  • Setup route: Events used to reach the source state, including whether setup counts towards coverage.
  • Test inputs: Ordered events, actor, guard values, request identities, and timing controls.
  • Expected sequence: State and relevant data after each evaluated event.
  • Expected effects: Created, changed, released, published, or preserved business records and their counts.
  • Completion evidence: Responses, authoritative reads, callback results, and bounded waiting criteria.
  • Reset and result: How independent executions are isolated and which coverage items actually passed.

For a negative attempt, capture a before-and-after comparison of the relevant effects. For an asynchronous event, include the correlation needed to establish that the observed result belongs to this execution.

Practical state transition testing checklist

  • Confirm the initial state and at least one reachable setup path for every tested source.
  • List allowed edges with source, event, guard, destination, and business effects.
  • Resolve relevant unlisted combinations before assigning pass or fail.
  • Test each required allowed transition with its specified effects.
  • Attempt forbidden events independently with otherwise valid inputs.
  • Exercise false guards separately from structurally forbidden events.
  • Check final-state actions without silently reopening the object.
  • Compare persisted state, revision or attempt identity, and effects after each step.
  • Distinguish fresh duplicate commands from replay and callback no-ops.
  • Exercise relevant competing-event orderings and check their invariants.
  • Verify that old callbacks cannot change a newer attempt or resurrect deleted work.
  • Report distinct covered states, transitions, negative entries, and remaining scope separately.

Common mistakes

  • Using state names as the whole model. A list containing Submitted and Cancelled does not specify which event connects them or what should happen to a reservation.
  • Equating all states with all transitions. The order example reaches every state while missing two cancellation branches.
  • Testing rejection with unrelated invalid inputs. An authentication or schema error can hide a service that would otherwise accept the forbidden transition.
  • Checking only the destination. A Confirmed order with duplicate reservations or an Approved request with the wrong revision still fails its business rule.
  • Chaining many invalid attempts without inspection. An early corrupting action can mask the cause of later failures.
  • Letting setup bypass required data. A manually created Processing status without an active attempt cannot reliably test current-attempt callback handling.
  • Counting broad percentages over an undefined scope. A four-event matrix says nothing about event variants that were deliberately left outside it.
  • Relying on an uncontrolled race. A passing result does not establish that competing operations reached the risky decision point together.

FAQ

Yes, a model can include a self-loop with defined effects. It can also distinguish an ignored input from a modeled transition. Document that choice before measuring coverage; the file example excludes acknowledged stale callbacks from its ten-edge inventory and verifies their no-op behavior separately.

Separate coherent objects or phases while preserving their required interactions. Keep a small model for each meaningful lifecycle and add integration sequences where their contracts meet. Do not remove a state solely to make the coverage percentage easier to achieve.

Yes. Create isolated fixtures, send events through the supported interface, and assert state plus business effects after each step. UI tests can cover user-visible actions and feedback, while service-level tests can exercise forbidden events that the UI does not offer.

It needs a known, valid source state. You can reach that state through ordinary events or a trustworthy fixture that establishes equivalent supporting data. A direct fixture is useful for speed, but it should not replace all checks of the real paths into that state.

Review them when a release changes allowed actions, guard conditions, state names, revision rules, retries, or event handling. Compare the changed rules with existing routes and coverage items, then add or revise the affected expectations. An unexplained implementation change is not sufficient reason to redefine the expected business behavior.

Ready to turn this guide into a working QA project with statuses, comments, and CSV export?