mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 08:56:35 +00:00
06b47c17c3
- Updated the coding rule descriptions to emphasize readability, meaningful comments, and test verification. - Revised guidelines to clarify the importance of avoiding boilerplate while maintaining readability. - Enhanced the testing rules to set a minimum coverage threshold of 75% for business logic and specified criteria for test scenarios. - Introduced a mechanism for handling skipped tests, categorizing them as legitimate or illegitimate, and outlined resolution steps. These changes aim to improve code quality, maintainability, and testing effectiveness.
16 lines
1.2 KiB
Plaintext
16 lines
1.2 KiB
Plaintext
---
|
|
description: "Testing conventions: Arrange/Act/Assert structure, naming, mocking strategy, coverage targets, test independence"
|
|
globs: ["**/*test*", "**/*spec*", "**/*Test*", "**/tests/**", "**/test/**"]
|
|
---
|
|
# Testing
|
|
|
|
- Structure every test with Arrange / Act / Assert section comments using language-appropriate syntax (`# Arrange` for Python, `// Arrange` for C#/Rust/JS/TS)
|
|
- One assertion per test when practical; name tests descriptively: `MethodName_Scenario_ExpectedResult`
|
|
- Test boundary conditions, error paths, and happy paths
|
|
- Use mocks only for external dependencies; prefer real implementations for internal code
|
|
- Aim for 75%+ coverage on business logic; 100% on critical paths (code paths where a bug would cause data loss, security breaches, financial errors, or system outages — identify from acceptance criteria marked as must-have or from security_approach.md). The 75% threshold is canonical — see `cursor-meta.mdc` Quality Thresholds.
|
|
- Integration tests use real database (Postgres testcontainers or dedicated test DB)
|
|
- Never use Thread Sleep or fixed delays in tests; use polling or async waits
|
|
- Keep test data factories/builders for reusable test setup
|
|
- Tests must be independent: no shared mutable state between tests
|