Test the allowed and prohibited transitions of an approval workflow.

Instruction: Provide a state model, concrete paths, and expected behavior for forbidden transitions.

Context:

A fictional request can be Draft, Submitted, Approved, Rejected, or Cancelled. Allowed transitions are Draft to Submitted or Cancelled; Submitted to Approved, Rejected, or Cancelled; and Rejected to Draft. Approved and Cancelled are terminal. No other transition, including a self-transition, is allowed. An invalid transition returns a domain error and leaves the stored state unchanged. Actors in this exercise have the required role; authorization is tested separately. Each successful transition records one history event.

Updated

Official answer available

Read the opening below, then unlock the full answer and practical guidance.

I would derive tests from the state model rather than from the visible buttons alone. The allowed edges are shown below. One useful path is Draft to Submitted to Rejected to Draft to Submitted to Approved...

Related Questions