NEWPractise supported commands in browser simulations, alongside the lesson.Try a browser practice exercise.Try a lab♥ Codelivly is 100% free, no paywall. If it helped you, chip in to keep it running.100% free. Help keep it so.Support us
Preview · 40 min
Turn the invoice lifecycle into states, transitions and a refusal grid, write invariants that must hold after any request, and check a recorded history against them.
A sentence such as "only draft invoices can be edited" is easy to agree with and awkward to test, because it says nothing about the other four states one by one, about deletion, or about a request that arrives while the state is changing. A model forces those gaps into view. For an invoice the model is small: five states, a handful of actions and the conditions under which each action is allowed.
Once that is drawn, test cases fall out of it almost mechanically, and so does a second kind of statement that no single request can express. "Credit notes on an invoice never add up to more than its total" is true or false about the stored records, whichever route wrote them. The raw material for both is in the documents collected before lunch.
Create a free account to unlock the rest of this task, complete tasks, and earn Rep.
Sign in