"Fast" Is Not a Requirement: Quality Scenarios
Almost every requirements document contains a sentence like this: "The system must be fast, scalable, secure and user-friendly." Nobody disagrees with it. Nobody can test it either. And when the system turns out to be slow, everybody discovers they meant something different by "fast".
A quality scenario replaces the adjective with a short, concrete story: something happens, under certain conditions, and the system responds in a way you can measure. It is the most practical tool there is for making quality goals real, and it fits in one sentence.
Anatomy of a Quality Scenario
A scenario has six parts. The format comes from Bass, Clements and Kazman's Software Architecture in Practice.
- Sourcewho or what triggers it
- Stimuluswhat happens
- Environmentunder which conditions
- Artifactwhich part of the system
- Responsewhat the system does
- Response measurehow we know it worked
| Part | Roarline example |
|---|---|
| Source | 50,000 fans |
| Stimulus | arrive within one minute of a sale opening |
| Environment | during normal operation with the waiting room active |
| Artifact | the checkout |
| Response | gives admitted fans a seat decision |
| Response measure | within 3 seconds for 99% of admitted fans |
Read together: "When 50,000 fans arrive within one minute of a sale opening, during normal operation with the waiting room active, the checkout gives admitted fans a seat decision within 3 seconds for 99% of admitted fans." That is something a load test can pass or fail.
Try It: Fix a Vague Requirement
The builder starts with the kind of requirement most projects begin with. Rewrite each part until all three checks turn green, or switch quality and look at how Roarline did it.
Scenario builder
Quality
Your scenario
Testable?
Feedback
Roarline's Quality Tree
One scenario is a good start; a system needs a handful. A quality tree (in Software Architecture in Practice called a utility tree) organises them: qualities at the top, refinements below (which aspect of the quality), concrete scenarios at the leaves. Each scenario gets two ratings: how important it is to the business and how difficult it is to achieve. Scenarios rated high on both are the ones that shape the architecture.
- Quality
- Correctness
- Seat inventory
- H, HWhen two fans try to buy the same seat at the same moment, Reservations sells it to exactly one of them, in 100% of cases.
- Payments
- H, MWhen the payment provider times out and the checkout retries, the fan is charged exactly once, in 100% of cases.
- Seat inventory
- Performance & elasticity
- Sale openings
- H, HWhen 50,000 fans arrive within one minute of a sale opening, 99% of admitted fans get a seat decision within 3 seconds.
- Browsing
- M, LWhen a fan opens an event page during normal operation, it loads within 1 second for 95% of requests.
- Sale openings
- Availability
- At the door
- H, MWhen the venue has no network, the scanner app admits a fan with a valid ticket within 1 second, for at least 6 hours.
- During sales
- H, MWhen one application instance crashes during a sale opening, fans in checkout see no error, and full capacity is back within 2 minutes.
- At the door
- Security
- Bots and scalpers
- M, HWhen a bot network sends 10,000 purchase attempts per minute, the waiting room blocks at least 95% of them, with fewer than 0.1% of real fans blocked by mistake.
- Bots and scalpers
- Modifiability
- Payment providers
- M, MWhen a developer adds a second payment provider, the change takes at most 10 working days and touches no module except Payments.
- Payment providers
- Correctness
Ratings: importance to the business, then difficulty to achieve. H = high, M = medium, L = low.
The two (H, H) scenarios explain most of Roarline's architecture on their own: the waiting room, strong consistency for seat reservations, and the decision to scale the application ahead of announced sales.
From Scenario to Test
A scenario you never check is a wish. The best scenarios turn into automated checks that run regularly, sometimes called fitness functions: tests for the architecture, not for a single feature.
| Roarline scenario | How it is checked |
|---|---|
| 50,000 fans in one minute | A load test against a production-like environment before every announced sale |
| Two fans, one seat | A concurrency test in the build: 1,000 parallel buyers, one seat, exactly one sale |
| Charged exactly once | Fault injection: drop and delay payment responses, count the charges (see the idempotency simulation) |
| Scanning without network | The scanner app's test suite runs in flight mode for a simulated evening |
| Payment changes stay in Payments | Architecture tests fail the build if any module other than Payments depends on payment-provider code. The 10-day limit itself is reviewed after each such change |
Common Mistakes
- Adjectives instead of numbers. "Fast", "scalable", "robust" and "secure" are where scenarios start, not where they end
- No environment. "Responds within 1 second" during a quiet Tuesday and during a sale opening are two very different requirements
- Averages instead of percentiles. An average of 1 second can hide a tenth of your users waiting 8 seconds. Say "for 99% of requests"
- Only the happy path. Some of the most valuable scenarios describe failures: a crashed instance, a slow provider, a missing network
- Too many scenarios. Twenty scenarios nobody reads help less than six that everybody knows. Rate them and focus on the high ones
- Scenarios nobody tests. If a scenario can't be checked, it will quietly stop being true
Where Scenarios Live
In arc42, the top three to five quality goals go into section 1, and the quality tree with its scenarios goes into section 10. ADRs can then name the scenario a decision serves, which makes the reasoning easy to check later: "We chose a waiting room because of the 50,000-fans scenario."
Key Takeaways
- "Fast" is a wish; "within 3 seconds for 99% of fans during a sale opening" is a requirement
- A scenario has six parts: source, stimulus, environment, artifact, response and response measure
- Rate scenarios by importance and difficulty; the high-high ones drive the architecture
- Write failure scenarios too, not only the happy path
- Turn the important scenarios into automated checks, so they stay true
Further Reading
- Len Bass, Paul Clements and Rick Kazman - Software Architecture in Practice: quality attribute scenarios and utility trees
- quality.arc42.org: a large collection of quality attributes with example requirements
- ISO/IEC 25010: the standard quality model, useful as a checklist of qualities you may have forgotten
- Neal Ford, Rebecca Parsons and Patrick Kua - Building Evolutionary Architectures: fitness functions