Fixup: test-one-when-per-test under 100 linjer (R11)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Michael Dieringer 2026-07-02 08:05:06 +02:00
parent 11eab57723
commit 4665e6f127

View file

@ -74,25 +74,20 @@ belongs in `[WHEN]`.
## Flow tests — the deliberate exception ## Flow tests — the deliberate exception
A **flow test** verifies the accumulated outcome of a multi-round business A **flow test** verifies the accumulated outcome of a multi-round business
flow — partial receipt then invoicing, multiple posting rounds against one flow (partial receipt then invoicing, multiple posting rounds against one
document. Here the sequence IS the scenario: the claim under test is "after document). The sequence IS the scenario — splitting it loses the interaction
round 1, 2 and 3, the balances are correct", and it cannot be expressed as under test. Multiple `[WHEN]` blocks are permitted when ALL of these hold:
three independent tests without losing the very interaction being verified.
Flow tests are permitted with multiple `[WHEN]` blocks when ALL of these hold: 1. The name declares the flow (`SVPartialFlowTests`,
`ReceiveThenInvoice_QuantitiesAreCorrect`).
1. The name declares the flow: the codeunit or procedure name contains the
sequence (`SVPartialFlowTests`, `ReceiveThenInvoice_QuantitiesAreCorrect`).
2. Each `[WHEN]` is labelled as a round of ONE scenario ("Runde 1: kun 2. Each `[WHEN]` is labelled as a round of ONE scenario ("Runde 1: kun
modtagelse"), not as an unrelated action. modtagelse"), not as an unrelated action.
3. The `[THEN]` asserts the accumulated end-state — not one unrelated claim 3. The `[THEN]` asserts the accumulated end-state. If the assertions
per WHEN. If the assertions decompose cleanly per action, it is two tests decompose cleanly per action, it is two tests in disguise: split.
in disguise: split.
Unit-level tests keep the strict one-WHEN rule without exception. (Edison Unit-level tests keep the strict one-WHEN rule without exception. (Edison
eval 2026-07-02, Jernpladsen @ b7656b1: five multi-WHEN procedures in eval 2026-07-02, Jernpladsen @ b7656b1: five deliberate round-labelled flow
SVPartialFlowTests, all deliberate round-labelled flows — the rule previously procedures in SVPartialFlowTests — the rule previously gave no verdict.)
gave no verdict on them.)
## Naming implication ## Naming implication