Skip to content

Commit 50f6b76

Browse files
authored
docs: require bare GWT labels in test comments (kroxylicious#4267)
The previous wording included an example with descriptive text after the colon ("When: proxy reconfigured with new filter chain") which was being used as licence to narrate every Given/When/Then comment. Replace with an explicit rule: bare labels only, no text after them. Assisted-by: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Sam Barker <sam@quadrocket.co.uk>
1 parent adbb211 commit 50f6b76

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

.claude/rules/testing.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ body alone, combined with the test name. A reader should be able to identify the
2626
and immediately know what is being tested without reading the class Javadoc or surrounding
2727
context.
2828

29-
Numbered phase comments (`// Phase 1`, `// Phase 2`) tell you sequence but hide intent:
30-
"Phase 3: reconfigure swaps the filter chain" and "When: proxy reconfigured with new filter
31-
chain" carry the same information, but only the second tells you that reconfigure is the action
32-
being tested, not more setup.
29+
Numbered phase comments (`// Phase 1`, `// Phase 2`) tell you sequence but hide intent —
30+
use `// Given`, `// When`, `// Then` instead.
31+
32+
**Write bare labels only:** `// Given`, `// When`, `// Then` — no text after the label.
33+
The code already says what's happening through types, variable names, and method names.
34+
Text like `// Given: a key pair and passwords` just narrates what the code already says.
3335

3436
## Given — minimum state, no assertions
3537

0 commit comments

Comments
 (0)