Skip to content

Commit d4ed0ad

Browse files
committed
docs: [#227] add essential rule for unit test naming conventions
- Add rule #15 to Essential Rules section in AGENTS.md - Emphasizes CRITICAL importance of using it_should_* pattern - Explicitly forbids test_* prefix for test function names - References docs/contributing/testing/unit-testing.md for details - Includes examples of correct vs incorrect naming - Preventive measure to avoid future test naming violations
1 parent 83014c5 commit d4ed0ad

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ These principles should guide all development decisions, code reviews, and featu
115115

116116
14. **When adding new templates**: Read [`docs/technical/template-system-architecture.md`](docs/technical/template-system-architecture.md) to understand the Project Generator pattern. The `templates/` directory contains source templates. Dynamic templates (`.tera`) are automatically processed, but static files must be explicitly registered in their respective `ProjectGenerator` to be copied to the build directory.
117117

118+
15. **When writing unit tests** (CRITICAL for test quality): Read [`docs/contributing/testing/unit-testing.md`](docs/contributing/testing/unit-testing.md) and follow the behavior-driven naming convention. **NEVER use the `test_` prefix** for test function names. Always use the `it_should_{expected_behavior}_when_{condition}` or `it_should_{expected_behavior}_given_{state}` pattern. This ensures tests clearly document the behavior being validated and the conditions under which it occurs. Example: `it_should_return_error_when_username_is_invalid()` instead of `test_invalid_username()`. Test names should follow the three-part structure (What-When-Then) and be descriptive enough that the test's purpose is clear without reading the code.
119+
118120
## 🧪 Build & Test
119121

120122
- **Setup Dependencies**: `cargo run --bin dependency-installer install` (sets up required development tools)

0 commit comments

Comments
 (0)