Overview
Tests against real databases catch the bugs that matter; metrics tell you about the ones that got through. I set up both, sized to the project.
NovaGate has 1,808 automated tests and 19 Prometheus metrics behind a Grafana dashboard. PAISAPAID has 485 test files, 138 of them integration tests against real PostgreSQL and Redis, plus a Playwright smoke suite for all five roles.
What's included
- Unit and integration tests with Jest, against real PostgreSQL and Redis
- End-to-end smoke tests with Playwright
- Guard tests that check rules across the codebase, such as every route having an access policy
- Prometheus metrics with bounded labels, and Grafana dashboards
- Logs with personal data redacted
- Error tracking for APIs and workers
- Test runs split into parallel CI shards so the suite stays fast
How I work
- 01
Test the edges that hurt
Cross-tenant access, permissions, money and retries get integration tests first.
- 02
Labels that don't explode
Metrics are labelled by route pattern, not raw URL, so the label set stays bounded.
- 03
Logs you can share
Logs redact IDs, phone numbers, emails and tokens, so they can be sent to a vendor or a colleague.
Shipped proof
Questions
- We have no tests. Where do we start?
- With integration tests on the riskiest flows (sign-in, permissions, payments) running in CI, not with a coverage target. Unit tests follow where the logic gets complicated.
- What should we monitor?
- Request rate, errors and latency per route, plus queue depth and the health of each dependency. Alerts go on what users feel, not on every metric.