TorbatYar/docs/development/testing-strategy.md
Mortezakoohjani 5c6a2e78cf feat(platform): seed service registry, deploy all modules, and fix homepage catalog.
Register all active platform services and base features in core DB so admin can manage them, add delivery/hospitality/sports-center backend phases, update apps catalog and production deploy tooling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 12:39:51 +03:30

2.0 KiB

Testing Strategy

Required Layers

Layer Purpose
Unit Pure domain logic, validators, mappers, specifications, policies
Service / Command / Query Business rules with DB/fakes; read-side without write side-effects
Repository Query correctness, tenant filters, soft-delete, page/filter/sort/search
API HTTP contracts, authz, status codes, OpenAPI smoke when pattern exists
Integration Multi-component flows (onboarding, OTP, SSO handoff)
Migration Upgrade/downgrade smoke on clean DB; seeds when required
Tenant Cross-tenant isolation negatives
Performance Hot entitlement/resolve/list paths as needed
Security Auth bypass attempts, token scope checks
Architecture Boundary/layering rules (service suites)
Documentation validation Links, registry completeness, DoD/handover for the phase
Permission Privileged route denial cases

Rules

  1. New behavior ships with tests in the same phase.
  2. Tenant tests must include at least one cross-tenant denial case for new tenant-scoped APIs.
  3. Do not rely on production data for assertions.
  4. Prefer deterministic time/OTP fakes.
  5. Phase is incomplete if tests fail or are absent for claimed deliverables.
  6. CRUD-only coverage without domain-rule tests is insufficient when business rules exist (definition-of-done.md).
  7. Architecture, security, and documentation validation are required for service/module implementation phases (testing-template.md).

Commands (current)

cd backend/core-service
pytest -q

cd backend/services/identity-access
pytest -q