Testing & Deployment
Testing Strategy
Comprehensive testing is crucial.
Unit Tests
- Focus: Individual functions, modules, classes within each microservice.
- Tools: Jest (for Node.js/TypeScript).
- Coverage: Aim for high coverage (>80%) for business-critical logic.
Integration Tests
- Focus: Interactions between components within a single microservice (e.g., API endpoint to database) or between closely coupled services (mocking external dependencies).
- Tools: Jest + Supertest (for API endpoint testing), Prisma test utilities for DB interactions. For Cloud Functions/Run, test their triggers and responses.
End-to-End (E2E) Tests
- Focus: Test complete user flows through the UI and APIs.
- Tools: Playwright or Cypress for UI E2E tests. API E2E tests can be written with Jest/Supertest or a tool like Postman/Newman against a deployed test environment.
- Scope: Critical paths like agent registration, device setup, recharge notification flow, payout request.
Load Testing
- Focus: System performance and stability under expected and peak load, particularly for the Transaction Ingestion API and core processing services.
- Tools: k6, Artillery, or GCP Cloud Load Testing.
- Metrics: Response times, error rates, resource utilization (CPU, memory, DB connections) under load. Test against documented low concurrency initially (100 users) and identify bottlenecks.