- Add comprehensive 8-phase implementation plan (docs/plan.md) - Add 28 Architecture Decision Records (docs/adr/) covering all phases - Add task tracking system with 283+ task files (docs/stories/) - Add task generator script for automated task file creation - Add reference playbooks and requirements documentation This commit establishes the complete planning foundation for the Go Platform implementation, documenting all architectural decisions and providing detailed task breakdown for Phases 0-8.
1.8 KiB
1.8 KiB
ADR-0028: Testing Strategy
Status
Accepted
Context
The platform needs a comprehensive testing strategy:
- Unit tests for individual components
- Integration tests for full flows
- Contract tests for API compatibility
- Load tests for performance
Testing tools and approaches vary in complexity and coverage.
Decision
Adopt a multi-layered testing approach:
-
Unit tests:
- Tool: Standard
testingpackage +testify - Coverage: >80% for core modules
- Mocks:
mockeryormockgen - Fast execution (< 1 second)
- Tool: Standard
-
Integration tests:
- Tool:
testcontainers-gofor Docker-based services - Coverage: End-to-end flows (auth, modules, etc.)
- Infrastructure: PostgreSQL, Redis, Kafka via testcontainers
- Tagged:
//go:build integration
- Tool:
-
Contract tests:
- Tool: OpenAPI validator (
kin-openapi) - Coverage: API request/response validation
- Optional: Pact for service contracts
- Tool: OpenAPI validator (
-
Load tests:
- Tool: k6 or vegeta
- Coverage: Critical endpoints (auth, API)
- Performance benchmarks
Rationale:
- Comprehensive coverage across layers
- Fast feedback with unit tests
- Realistic testing with integration tests
- API compatibility with contract tests
- Performance validation with load tests
Consequences
Positive
- High confidence in code quality
- Fast unit tests for quick feedback
- Realistic integration tests
- API compatibility guaranteed
Negative
- Integration tests are slower
- Requires Docker for testcontainers
- More complex CI setup
Implementation Notes
- Use
testifyfor assertions:requireandassert - Generate mocks with
mockeryormockgen - Create test helpers in
internal/testutil/ - Use test tags:
go test -tags=integration ./... - Run integration tests in separate CI job
- Document testing approach in
CONTRIBUTING.md